Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions iocore/cache/Cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3089,6 +3089,7 @@ register_cache_stats(RecRawStatBlock *rsb, const char *prefix)
REG_INT("read.success", cache_read_success_stat);
REG_INT("read.failure", cache_read_failure_stat);
REG_INT("read.seek.failure", cache_read_seek_fail_stat);
REG_INT("read.invalid", cache_read_invalid_stat);
REG_INT("write.active", cache_write_active_stat);
REG_INT("write.success", cache_write_success_stat);
REG_INT("write.failure", cache_write_failure_stat);
Expand Down
14 changes: 14 additions & 0 deletions iocore/cache/CacheRead.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,20 @@ CacheVC::openReadStartHead(int event, Event *e)
} else {
f.single_fragment = false;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should be checked when selecting alternates, but then it wouldn't get cleaned up as well.

// Now that we have selected an alternate, validate that the content length and object size match
MIMEField *field = alternate.response_get()->field_find(MIME_FIELD_CONTENT_LENGTH, MIME_LEN_CONTENT_LENGTH);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few style things -

if ( auto field = alternate.response_get()->field_find(MIIME_FIELD_CONTENT_LENGTH, MIME_LEN_CONTENT_LENGTH) ; field ) {
  if ( auto cl = static_cast<uint64_t>(field->value_get_int64()) ; cl != doc_len) {
    // ...
  }
}

if (field) {
uint64_t cl = static_cast<uint64_t>(field->value_get_int64());
if (cl != doc_len) {
Warning("OpenReadHead failed for cachekey %X : alternate content length doesn't match doc_len %ld != %ld", key.slice32(0),
cl, doc_len);
CACHE_INCREMENT_DYN_STAT(cache_read_invalid_stat);
err = ECACHE_BAD_META_DATA;
goto Ldone;
}
}

} else {
next_CacheKey(&key, &doc->key);
f.single_fragment = doc->single_fragment();
Expand Down
1 change: 1 addition & 0 deletions iocore/cache/P_CacheInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ enum {
cache_read_success_stat,
cache_read_failure_stat,
cache_read_seek_fail_stat,
cache_read_invalid_stat,
cache_write_active_stat,
cache_write_success_stat,
cache_write_failure_stat,
Expand Down