only making remarks that I noticed on a rough code-review.
[snip]
> @@ -516,6 +528,10 @@ Vol::begin_read(CacheVC *cont)
> // no need for evacuation as the entire document is already in
> memory
> if (cont->f.single_fragment)
> return 0;
> +#if TS_USE_INTERIM_CACHE == 1
> + if (dir_ininterim(&cont->earliest_dir))
> + return 0;
> +#endif
> int i = dir_evac_bucket(&cont->earliest_dir);
> EvacuationBlock *b;
> for (b = evacuate[i].head; b; b = b->link.next) {
> @@ -598,7 +614,83 @@ CacheProcessor::start_internal(int flags)
> fix = !!(flags & PROCESSOR_FIX);
> start_done = 0;
> int diskok = 1;
> + Span *sd;
> +#if TS_USE_INTERIM_CACHE == 1
> + gn_interim_disks = theCacheStore.n_interim_disks;
> + g_interim_disks = (CacheDisk **) ats_malloc(gn_interim_disks *
> sizeof(CacheDisk *));
>
> + gn_interim_disks = 0;
> +
> + for (int i = 0; i < theCacheStore.n_interim_disks; i++) {
> + sd = theCacheStore.interim_disk[i];
> + char path[PATH_MAX];
> + int opts = O_RDWR;
> + ink_strlcpy(path, sd->pathname, sizeof(path));
> + if (!sd->file_pathname) {
> +#if !defined(_WIN32)
huh?!
> @@ -606,8 +698,13 @@ CacheProcessor::start_internal(int flags)
>
> gndisks = 0;
> ink_aio_set_callback(new AIO_Callback_handler());
> - Span *sd;
> +
> config_volumes.read_config_file();
> +#if TS_USE_INTERIM_CACHE == 1
> + total_cache_size = 0;
> + for (unsigned i = 0; i < theCacheStore.n_disks; i++)
> + total_cache_size += theCacheStore.disk[i]->blocks;
> +#endif
> for (unsigned i = 0; i < theCacheStore.n_disks; i++) {
> sd = theCacheStore.disk[i];
> char path[PATH_NAME_MAX];
> @@ -864,6 +961,9 @@ CacheProcessor::cacheInitialized()
> for (i = 0; i < gnvol; i++) {
> vol = gvol[i];
> gvol[i]->ram_cache->init(vol_dirlen(vol), vol);
> +#if TS_USE_INTERIM_CACHE == 1
> + gvol[i]->history.init(1<<20, 2097143);
> +#endif
> ram_cache_bytes += vol_dirlen(gvol[i]);
> Debug("cache_init", "CacheProcessor::cacheInitialized -
> ram_cache_bytes = %" PRId64 " = %" PRId64 "Mb",
> ram_cache_bytes, ram_cache_bytes / (1024 * 1024));
> @@ -923,7 +1023,9 @@ CacheProcessor::cacheInitialized()
Can you please explain what these shifts do?
> }
> Debug("cache_init", "CacheProcessor::cacheInitialized[%d]
> - ram_cache_bytes = %" PRId64 " = %" PRId64 "Mb",
> i, ram_cache_bytes, ram_cache_bytes / (1024 *
> 1024));
> -
> +#if TS_USE_INTERIM_CACHE == 1
> + gvol[i]->history.init(1<<20, 2097143);
> +#endif
> vol_total_cache_bytes = gvol[i]->len -
> vol_dirlen(gvol[i]);
> total_cache_bytes += vol_total_cache_bytes;
> CACHE_VOL_SUM_DYN_STAT(cache_bytes_total_stat,
> vol_total_cache_bytes);
> @@ -1151,6 +1253,19 @@ Vol::init(char *s, off_t blocks, off_t
I just noticed this for the first time in our code:
> @@ -155,15 +157,42 @@ struct FreeDir
> unsigned int reserved:8;
> unsigned int prev:16; // (2)
> unsigned int next:16; // (3)
> +#if TS_USE_INTERIM_CACHE == 1
> + unsigned int offset_high:12; // 8GB * 4K = 32TB
> + unsigned int index:3; // interim index
> + unsigned int ininterim:1; // in interim or not
and remembered that the use of bitfields is frowned upon by compiler geeks.
Do we have any documentation on this structure and the intent behind its design?
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8006abcb/iocore/cache/P_CacheVol.h
> ----------------------------------------------------------------------
> diff --git a/iocore/cache/P_CacheVol.h b/iocore/cache/P_CacheVol.h
> index 86e9389..ba328a5 100644
> --- a/iocore/cache/P_CacheVol.h
> +++ b/iocore/cache/P_CacheVol.h
> @@ -128,6 +128,261 @@ struct EvacuationBlock
> LINK(EvacuationBlock, link);
> };
>
> +#if TS_USE_INTERIM_CACHE == 1
> +#define MIGRATE_BUCKETS 1021
What's the reason behind this number?
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8006abcb/mgmt/RecordsConfig.cc
> ----------------------------------------------------------------------
> diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
> index fbc101a..8a2193b 100644
> --- a/mgmt/RecordsConfig.cc
> +++ b/mgmt/RecordsConfig.cc
> @@ -940,6 +940,12 @@ RecordElement RecordsConfig[] = {
> ,
> {RECT_CONFIG, "proxy.config.cache.target_fragment_size", RECD_INT,
> "1048576", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
> ,
> + // # only be used when compiled with --enable-interim-cache
> + {RECT_LOCAL, "proxy.config.cache.interim.storage", RECD_STRING,
> NULL, RECU_RESTART_TS, RR_NULL, RECC_NULL, NULL, RECA_NULL}
> + ,
> + // # only be used when compiled with --enable-interim-cache
> + {RECT_CONFIG, "proxy.config.cache.interim.migrate_threshold",
> RECD_INT, "2", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
> + ,
> // # The maximum size of a document that will be stored in the
> cache.
> // # (0 disables the maximum document size check)
> {RECT_CONFIG, "proxy.config.cache.max_doc_size", RECD_INT, "0",
> RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8006abcb/proxy/config/records.config.default.in
> ----------------------------------------------------------------------
> diff --git a/proxy/config/records.config.default.in
> b/proxy/config/records.config.default.in
> index 5918afb..ab7c6ea 100644
> --- a/proxy/config/records.config.default.in
> +++ b/proxy/config/records.config.default.in
> @@ -370,6 +370,10 @@ CONFIG proxy.config.cache.threads_per_disk INT 8
> # this low can reduce latencies in some cases, but can consume
> more CPU.
> # If you experience CPU spinning, try increasing this setting.
> CONFIG proxy.config.cache.mutex_retry_delay INT 2
> + # The interim storage disks. Must use raw disks.
> + # Only support at most 8 interim disks now. e.g.
> + # proxy.config.cache.interim.storage STRING /dev/sda /dev/sdb/
> +LOCAL proxy.config.cache.interim.storage STRING NULL
>
> ##############################################################################
> #
> # DNS
Why is proxy.config.cache.interim.migrate_threshold not documented here, only
in commit message?
that's all from me.
-- i
Igor Galić
Tel: +43 (0) 664 886 22 883
Mail: [email protected]
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515 2EA5 4B1D 9E08 A097 C9AE