John, thanks for the idea. Here is what happened -
First, I just changed the test in CacheWrite.cc as you said. I wasn't clear on whether the assert() should now be satisfied or not without moving it.. the test continued to fail in the same way. Then I moved the assert from cachedir to cachewrite as you indicated - the test runs a bit longer subjectively, but it fails on the (new) assert. I don't yet understand the flow of the cache code. This is the patch:: diff --git a/iocore/cache/CacheDir.cc b/iocore/cache/CacheDir.cc index 2cb271f..28e98f6 100644 --- a/iocore/cache/CacheDir.cc +++ b/iocore/cache/CacheDir.cc @@ -690,7 +690,7 @@ dir_overwrite(CacheKey * key, Part * d, Dir * dir, Dir * overwrite, bool must_ov check_dir(d); #endif - ink_assert((unsigned int) dir_approx_size(dir) <= (unsigned int) (MAX_FRAG_SIZE + sizeofDoc)); // XXX - size should be unsigned + Lagain: // find entry to overwrite e = b; diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc index a1f529a..1e0966a 100644 --- a/iocore/cache/CacheWrite.cc +++ b/iocore/cache/CacheWrite.cc @@ -791,6 +791,8 @@ agg_copy(char *p, CacheVC * vc) ink_assert(part_offset(part, &vc->dir) < (part->skip + part->len)); dir_set_phase(&vc->dir, part->header->phase); + ink_assert((unsigned int) dir_approx_size(&vc->dir) <= (unsigned int) (MAX_FRAG_SIZE + sizeofDoc)); // XXX - size should be unsigned + // fill in document header doc->magic = DOC_MAGIC; doc->len = seglen; @@ -1362,7 +1364,8 @@ Lagain: total_len += avail; } length = towrite; - if (length > TARGET_FRAG_SIZE && length < SHRINK_TARGET_FRAG_SIZE) + // if (length > TARGET_FRAG_SIZE && length < SHRINK_TARGET_FRAG_SIZE) + if (length > TARGET_FRAG_SIZE) write_len = TARGET_FRAG_SIZE; else write_len = length;