diff options
Diffstat (limited to 'tests/libs/zbxdbcache/valuecache_test.c')
-rw-r--r-- | tests/libs/zbxdbcache/valuecache_test.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/tests/libs/zbxdbcache/valuecache_test.c b/tests/libs/zbxdbcache/valuecache_test.c index 1570e039828..d85bdf04273 100644 --- a/tests/libs/zbxdbcache/valuecache_test.c +++ b/tests/libs/zbxdbcache/valuecache_test.c @@ -31,8 +31,6 @@ int zbx_vc_get_cached_values(zbx_uint64_t itemid, unsigned char value_type, zbx_ int i; zbx_vc_chunk_t *chunk; - vc_try_lock(); - if (NULL == (item = zbx_hashset_search(&vc_cache->items, &itemid))) return FAIL; @@ -45,8 +43,6 @@ int zbx_vc_get_cached_values(zbx_uint64_t itemid, unsigned char value_type, zbx_ vc_history_record_vector_append(values, value_type, &chunk->slots[i]); } - vc_try_unlock(); - return SUCCEED; } @@ -56,8 +52,6 @@ int zbx_vc_precache_values(zbx_uint64_t itemid, int value_type, int seconds, int int ret; zbx_vector_history_record_t values; - vc_try_lock(); - /* add item to cache if necessary */ if (NULL == (item = (zbx_vc_item_t *)zbx_hashset_search(&vc_cache->items, &itemid))) { @@ -66,18 +60,17 @@ int zbx_vc_precache_values(zbx_uint64_t itemid, int value_type, int seconds, int } /* perform request to cache values */ - vc_item_addref(item); zbx_history_record_vector_create(&values); + RDLOCK_CACHE; ret = vch_item_get_values(item, &values, seconds, count, ts); + UNLOCK_CACHE; + zbx_vc_flush_stats(); zbx_history_record_vector_destroy(&values, value_type); - vc_item_release(item); /* reset cache statistics */ vc_cache->hits = 0; vc_cache->misses = 0; - vc_try_unlock(); - return ret; } @@ -87,8 +80,6 @@ int zbx_vc_get_item_state(zbx_uint64_t itemid, int *status, int *active_range, i zbx_vc_item_t *item; int ret = FAIL; - vc_try_lock(); - if (NULL != (item = (zbx_vc_item_t *)zbx_hashset_search(&vc_cache->items, &itemid))) { *status = item->status; @@ -99,8 +90,6 @@ int zbx_vc_get_item_state(zbx_uint64_t itemid, int *status, int *active_range, i ret = SUCCEED; } - vc_try_unlock(); - return ret; } @@ -109,13 +98,9 @@ int zbx_vc_get_cache_state(int *mode, zbx_uint64_t *hits, zbx_uint64_t *misses) if (NULL == vc_cache) return FAIL; - vc_try_lock(); - *mode = vc_cache->mode; *hits = vc_cache->hits; *misses = vc_cache->misses; - vc_try_unlock(); - return SUCCEED; } |