调整cache key的输出格式

This commit is contained in:
zhengchao
2018-11-14 16:00:07 +08:00
parent 6bcd2cb9a6
commit eed9ebcadb

View File

@@ -88,7 +88,6 @@ struct cache_bloom
double error_rate; double error_rate;
char filename[TFE_PATH_MAX]; char filename[TFE_PATH_MAX];
counting_bloom_t *bloom; counting_bloom_t *bloom;
void * ref_logger;
}; };
struct cache_handle struct cache_handle
{ {
@@ -597,7 +596,6 @@ static void cache_key_bloom_gc_cb(evutil_socket_t fd, short what, void * arg)
new_bloom=new_counting_bloom(p_bloom->size, p_bloom->error_rate, p_bloom->filename); new_bloom=new_counting_bloom(p_bloom->size, p_bloom->error_rate, p_bloom->filename);
free_counting_bloom(p_bloom->bloom); free_counting_bloom(p_bloom->bloom);
p_bloom->bloom=new_bloom; p_bloom->bloom=new_bloom;
TFE_LOG_DEBUG(p_bloom->ref_logger, "Bloom filter %d:%s resets.", p_bloom->thread_id, p_bloom->filename);
return; return;
} }
@@ -633,7 +631,6 @@ struct cache_handle* create_web_cache_handle(const char* profile_path, const cha
p_bloom->thread_id=i; p_bloom->thread_id=i;
p_bloom->size=cache->cache_key_bloom_size; p_bloom->size=cache->cache_key_bloom_size;
p_bloom->error_rate=0.01; p_bloom->error_rate=0.01;
p_bloom->ref_logger=logger;
snprintf(p_bloom->filename, sizeof(p_bloom->filename), "/tmp/pangu_cache_blooms.%02d", i); snprintf(p_bloom->filename, sizeof(p_bloom->filename), "/tmp/pangu_cache_blooms.%02d", i);
p_bloom->bloom=new_counting_bloom(p_bloom->size, p_bloom->error_rate, p_bloom->filename); p_bloom->bloom=new_counting_bloom(p_bloom->size, p_bloom->error_rate, p_bloom->filename);
if(p_bloom->bloom==NULL) if(p_bloom->bloom==NULL)
@@ -650,6 +647,7 @@ struct cache_handle* create_web_cache_handle(const char* profile_path, const cha
goto error_out; goto error_out;
} }
} }
MESA_load_profile_int_def(profile_path, section, "get_concurrency_max", &temp, 1000*1000); MESA_load_profile_int_def(profile_path, section, "get_concurrency_max", &temp, 1000*1000);
cache->get_concurrency_max=temp; cache->get_concurrency_max=temp;
MESA_load_profile_int_def(profile_path, section, "put_concurrency_max", &(temp), 1000*1000); MESA_load_profile_int_def(profile_path, section, "put_concurrency_max", &(temp), 1000*1000);
@@ -672,7 +670,7 @@ struct cache_handle* create_web_cache_handle(const char* profile_path, const cha
cache->default_cache_policy.pinning_time_sec=0; cache->default_cache_policy.pinning_time_sec=0;
cache->default_cache_policy.inactive_time_sec=0; cache->default_cache_policy.inactive_time_sec=0;
cache->default_cache_policy.max_cache_size=0; cache->default_cache_policy.max_cache_size=0;
cache->default_cache_policy.max_cache_obj_size=1024*1024*1024;//<1GB cache->default_cache_policy.max_cache_obj_size=1024*1024*1024;//<1GB by default
if(cache->cache_policy_enabled) if(cache->cache_policy_enabled)
{ {
@@ -683,7 +681,6 @@ struct cache_handle* create_web_cache_handle(const char* profile_path, const cha
cache_param_new, cache_param_free, cache_param_dup, cache_param_new, cache_param_free, cache_param_dup,
0, cache); 0, cache);
cache->ref_feather=feather; cache->ref_feather=feather;
TFE_LOG_INFO(logger, "Cache Policy Enabled.");
} }
cache_stat_init(cache); cache_stat_init(cache);
return cache; return cache;
@@ -1009,7 +1006,7 @@ enum cache_pending_result web_cache_async_pending(struct cache_handle* handle, u
{ {
_mid->cache_key=get_cache_key(request, &(param->key_descr)); _mid->cache_key=get_cache_key(request, &(param->key_descr));
} }
TFE_LOG_DEBUG(handle->logger, "cache policy %d matched: url=%s alt-key=%s", TFE_LOG_DEBUG(handle->logger, "cache policy %d matched: url=%s alternative key=%s",
cache_policy.config_id, cache_policy.config_id,
request->req_spec.url, request->req_spec.url,
_mid->cache_key!=NULL?_mid->cache_key:"null"); _mid->cache_key!=NULL?_mid->cache_key:"null");