trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject git commit: TS-1940 HostDB would get reinitialized on startup
Date Wed, 05 Jun 2013 22:30:56 GMT
Updated Branches:
  refs/heads/master 1422dd1b6 -> af80e8590


TS-1940 HostDB would get reinitialized on startup


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/af80e859
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/af80e859
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/af80e859

Branch: refs/heads/master
Commit: af80e85903c0dae50f6c7062eb57a0ccd0f58f9b
Parents: 1422dd1
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Wed Jun 5 16:30:06 2013 -0600
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Wed Jun 5 16:30:06 2013 -0600

----------------------------------------------------------------------
 CHANGES                     |    2 ++
 iocore/hostdb/MultiCache.cc |   20 +++++++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/af80e859/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 37d58d6..be202e6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
   Changes with Apache Traffic Server 3.3.4
 
 
+  *) [TS-1940] HostDB gets reinitialized on startup.
+
   *) [TS-1941] Make Linux native-AIO build cleanly.
 
   *) [TS-1938] Remove unnecessary thread_id() wrapper in reclaimable freelist.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/af80e859/iocore/hostdb/MultiCache.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/MultiCache.cc b/iocore/hostdb/MultiCache.cc
index 79a859e..ebdea6c 100644
--- a/iocore/hostdb/MultiCache.cc
+++ b/iocore/hostdb/MultiCache.cc
@@ -327,12 +327,22 @@ MultiCacheBase::mmap_data(bool private_flag, bool zero_fill)
         fds[n_fds] = 0;
       }
       if (!d->file_pathname) {
-        int err;
-        err = ink_file_fd_zerofill(fds[n_fds], (off_t)(d->blocks * STORE_BLOCK_SIZE));
-        if (err != 0) {
-          Warning("unable to set file '%s' size to %" PRId64 ": %d, %s",
-                  path, (int64_t) d->blocks * STORE_BLOCK_SIZE, err, strerror(err));
+        struct stat fd_stat;
+
+        if (fstat(fds[n_fds], &fd_stat) < 0) {
+          Warning("unable to stat file '%s'", path);
           goto Lalloc;
+        } else {
+          int64_t size = (off_t)(d->blocks * STORE_BLOCK_SIZE);
+
+          if (fd_stat.st_size != size) {
+            int err = ink_file_fd_zerofill(fds[n_fds], size);
+
+            if (err != 0) {
+              Warning("unable to set file '%s' size to %" PRId64 ": %d, %s", path, size,
err, strerror(err));
+              goto Lalloc;
+            }
+          }
         }
       }
       n_fds++;


Mime
View raw message