You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2010/05/27 17:45:46 UTC
svn commit: r948865 - in /trafficserver/traffic/trunk/iocore: cache/Store.cc
hostdb/HostDB.cc hostdb/MultiCache.cc
Author: zwoop
Date: Thu May 27 15:45:46 2010
New Revision: 948865
URL: http://svn.apache.org/viewvc?rev=948865&view=rev
Log:
TS-379: Fix off-by-one bug when creating HostDB (and other cache paths)
Tested: FC12
Modified:
trafficserver/traffic/trunk/iocore/cache/Store.cc
trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc
trafficserver/traffic/trunk/iocore/hostdb/MultiCache.cc
Modified: trafficserver/traffic/trunk/iocore/cache/Store.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/Store.cc?rev=948865&r1=948864&r2=948865&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/Store.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/Store.cc Thu May 27 15:45:46 2010
@@ -228,11 +228,11 @@ Span::path(char *filename, int64 * aoffs
return -1;
ink_strncpy(buf, ds->pathname, buflen);
if (!ds->file_pathname) {
- if (pl && buf[pl - 1] != '/') {
- buf[pl - 1] = '/';
- buf[pl++] = '\0';
+ if (pl && buf[pl-1] != '/') {
+ buf[pl] = '/';
+ buf[pl+1] = '\0';
}
- strncat(buf, filename, buflen - (pl + ll + 1));
+ strncat(buf, filename, buflen - (pl + ll + 2));
}
return strlen(buf);
Modified: trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc?rev=948865&r1=948864&r2=948865&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc Thu May 27 15:45:46 2010
@@ -324,6 +324,9 @@ HostDBCache::start(int flags)
Layout::relative_to(storage_path, PATH_NAME_MAX,
system_root_dir, storage_path);
}
+
+ Debug("hostdb", "Storage path is %s", storage_path);
+
struct stat s;
int err;
if ((err = stat(storage_path, &s)) < 0) {
@@ -338,6 +341,7 @@ HostDBCache::start(int flags)
hostDBSpan->init(storage_path, storage_size);
hostDBStore->add(hostDBSpan);
+ Debug("hostdb", "Opening %s, size=%d", hostdb_filename, hostdb_size);
if (open(hostDBStore, "hostdb.config", hostdb_filename, hostdb_size, reconfigure, fix, false /* slient */ ) < 0) {
Note("reconfiguring host database");
@@ -360,7 +364,6 @@ HostDBCache::start(int flags)
return -1;
}
}
-
HOSTDB_SET_DYN_COUNT(hostdb_bytes_stat, totalsize);
// XXX I don't see this being reference in the previous function calls, so I am going to delete it -bcall
delete hostDBStore;
Modified: trafficserver/traffic/trunk/iocore/hostdb/MultiCache.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/MultiCache.cc?rev=948865&r1=948864&r2=948865&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/MultiCache.cc (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/MultiCache.cc Thu May 27 15:45:46 2010
@@ -114,6 +114,8 @@ MultiCacheBase::initialize(Store * astor
int level1_elements_per_bucket, int level2_elements_per_bucket)
{
int64 size = 0;
+
+ Debug("multicache", "initializing %s with %d elements, %d buckets and %d levels", afilename, aelements, abuckets, alevels);
ink_assert(alevels < 4);
levels = alevels;
elementsize = get_elementsize();