MCPcopy Create free account
hub / github.com/apache/trafficserver / cacheInitialized

Method cacheInitialized

src/iocore/cache/CacheProcessor.cc:1388–1572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1386}
1387
1388void
1389CacheProcessor::cacheInitialized()
1390{
1391 if (theCache == nullptr) {
1392 Dbg(dbg_ctl_cache_init, "theCache is nullptr");
1393 return;
1394 }
1395
1396 if (theCache->ready == CACHE_INITIALIZING) {
1397 Dbg(dbg_ctl_cache_init, "theCache is initializing");
1398 return;
1399 }
1400
1401 int caches_ready = 0;
1402 int cache_init_ok = 0;
1403 /* allocate ram size in proportion to the disk space the
1404 volume occupies */
1405 int64_t total_size = 0; // count in HTTP & MIXT
1406
1407 total_size += theCache->cache_size;
1408 Dbg(dbg_ctl_cache_init, "theCache, total_size = %" PRId64 " = %" PRId64 " MB", total_size,
1409 total_size / ((1024 * 1024) / STORE_BLOCK_SIZE));
1410 if (theCache->ready == CACHE_INIT_FAILED) {
1411 Dbg(dbg_ctl_cache_init, "failed to initialize the cache for http: cache disabled");
1412 Warning("failed to initialize the cache for http: cache disabled\n");
1413 } else {
1414 caches_ready = caches_ready | (1 << CACHE_FRAG_TYPE_HTTP);
1415 caches_ready = caches_ready | (1 << CACHE_FRAG_TYPE_NONE);
1416 caches[CACHE_FRAG_TYPE_HTTP] = theCache;
1417 caches[CACHE_FRAG_TYPE_NONE] = theCache;
1418 }
1419
1420 // Update stripe version data.
1421 if (gnstripes) { // start with whatever the first stripe is.
1422 cacheProcessor.min_stripe_version = cacheProcessor.max_stripe_version = gstripes[0]->directory.header->version;
1423 }
1424 // scan the rest of the stripes.
1425 for (int i = 1; i < gnstripes; i++) {
1426 StripeSM *v = gstripes[i];
1427 if (v->directory.header->version < cacheProcessor.min_stripe_version) {
1428 cacheProcessor.min_stripe_version = v->directory.header->version;
1429 }
1430 if (cacheProcessor.max_stripe_version < v->directory.header->version) {
1431 cacheProcessor.max_stripe_version = v->directory.header->version;
1432 }
1433 }
1434
1435 if (caches_ready) {
1436 Dbg(dbg_ctl_cache_init, "CacheProcessor::cacheInitialized - caches_ready=0x%0X, gnvol=%d", (unsigned int)caches_ready,
1437 gnstripes.load());
1438
1439 if (gnstripes) {
1440 // new ram_caches, with algorithm from the config
1441 for (int i = 0; i < gnstripes; i++) {
1442 switch (cache_config_ram_cache_algorithm) {
1443 default:
1444 case RAM_CACHE_ALGORITHM_CLFUS:
1445 gstripes[i]->ram_cache = new_RamCacheCLFUS();

Callers 1

open_doneMethod · 0.80

Calls 10

new_RamCacheCLFUSFunction · 0.85
new_RamCacheLRUFunction · 0.85
incrementFunction · 0.85
dir_entries_usedFunction · 0.85
dir_sync_initFunction · 0.85
dirlenMethod · 0.80
entriesMethod · 0.80
waitForCacheMethod · 0.80
loadMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected