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 2013/04/15 23:19:30 UTC

[01/50] git commit: TS-1751 when ts have high cpu usage, cluster thread isn't balance

Updated Branches:
  refs/heads/3.3.x f591c2365 -> d64480be9


TS-1751  when ts have high cpu usage, cluster thread isn't balance


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

Branch: refs/heads/3.3.x
Commit: 7b2bc024aace7515c9638063a9c434da40b80799
Parents: 3050ce9
Author: Chen Bin <ku...@taobao.com>
Authored: Tue Apr 2 13:29:21 2013 +0800
Committer: Chen Bin <ku...@taobao.com>
Committed: Tue Apr 2 13:29:21 2013 +0800

----------------------------------------------------------------------
 iocore/cluster/ClusterHandlerBase.cc |   70 ++++++++++++++++++++++++----
 iocore/cluster/P_ClusterHandler.h    |    3 +
 2 files changed, 63 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7b2bc024/iocore/cluster/ClusterHandlerBase.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterHandlerBase.cc b/iocore/cluster/ClusterHandlerBase.cc
index ee8070c..1a4e2ef 100644
--- a/iocore/cluster/ClusterHandlerBase.cc
+++ b/iocore/cluster/ClusterHandlerBase.cc
@@ -984,7 +984,6 @@ ClusterHandler::startClusterEvent(int event, Event * e)
       {
         int proto_major = -1;
         int proto_minor = -1;
-        int failed = 0;
 
         clusteringVersion.AdjustByteOrder();
         /////////////////////////////////////////////////////////////////////////
@@ -1026,6 +1025,64 @@ ClusterHandler::startClusterEvent(int event, Event * e)
         if (!connector)
           id = clusteringVersion._id & 0xffff;
 
+        machine->msg_proto_major = proto_major;
+        machine->msg_proto_minor = proto_minor;
+
+        thread = eventProcessor.eventthread[ET_CLUSTER][id % eventProcessor.n_threads_for_type[ET_CLUSTER]];
+        if (net_vc->thread == thread) {
+          cluster_connect_state = CLCON_CONN_BIND_OK;
+          break;
+        } else { 
+          cluster_connect_state = ClusterHandler::CLCON_CONN_BIND_CLEAR;
+          thread->schedule_in(this, CLUSTER_PERIOD);
+          return EVENT_DONE;
+        }
+      }
+
+    case ClusterHandler::CLCON_CONN_BIND_CLEAR:
+      {
+        //
+        UnixNetVConnection *vc = (UnixNetVConnection *)net_vc; 
+        MUTEX_TRY_LOCK(lock, vc->nh->mutex, e->ethread);
+        MUTEX_TRY_LOCK(lock1, vc->mutex, e->ethread);
+        if (lock && lock1) {
+          vc->ep.stop();
+          vc->nh->open_list.remove(vc);
+          vc->nh = NULL;
+          vc->thread = NULL;
+          cluster_connect_state = ClusterHandler::CLCON_CONN_BIND;
+        } else {
+          thread->schedule_in(this, CLUSTER_PERIOD);
+          return EVENT_DONE;
+        }
+      }
+
+    case ClusterHandler::CLCON_CONN_BIND:
+      {
+        // 
+        NetHandler *nh = get_NetHandler(e->ethread);
+        UnixNetVConnection *vc = (UnixNetVConnection *)net_vc; 
+        MUTEX_TRY_LOCK(lock, nh->mutex, e->ethread);
+        MUTEX_TRY_LOCK(lock1, vc->mutex, e->ethread);
+        if (lock && lock1) {
+          vc->nh = nh;
+          vc->nh->open_list.enqueue(vc);
+          vc->thread = e->ethread;
+          PollDescriptor *pd = get_PollDescriptor(e->ethread);
+          if (vc->ep.start(pd, vc, EVENTIO_READ|EVENTIO_WRITE) < 0) {
+            cluster_connect_state = ClusterHandler::CLCON_DELETE_CONNECT;
+            break;                // goto next state
+          }
+        } else {
+          thread->schedule_in(this, CLUSTER_PERIOD);
+          return EVENT_DONE;
+        }
+      }
+
+    case ClusterHandler::CLCON_CONN_BIND_OK:
+      {
+        int failed = 0;
+
         // include this node into the cluster configuration
         MUTEX_TAKE_LOCK(the_cluster_config_mutex, this_ethread());
         MachineList *cc = the_cluster_config();
@@ -1068,8 +1125,6 @@ failed:
         }
 
         this->needByteSwap = !clusteringVersion.NativeByteOrder();
-        machine->msg_proto_major = proto_major;
-        machine->msg_proto_minor = proto_minor;
 #ifdef NON_MODULAR
         machine_online_APIcallout(ip);
 #endif
@@ -1083,7 +1138,7 @@ failed:
         Note("machine up %hhu.%hhu.%hhu.%hhu:%d, protocol version=%d.%d",
              DOT_SEPARATED(ip), id, clusteringVersion._major, clusteringVersion._minor);
 #endif
-        thread = e->ethread;
+
         read_vcs = NEW((new Queue<ClusterVConnectionBase, ClusterVConnectionBase::Link_read_link>[CLUSTER_BUCKETS]));
         write_vcs = NEW((new Queue<ClusterVConnectionBase, ClusterVConnectionBase::Link_write_link>[CLUSTER_BUCKETS]));
         SET_HANDLER((ClusterContHandler) & ClusterHandler::beginClusterEvent);
@@ -1092,12 +1147,7 @@ failed:
         read.do_iodone_event = true;
         write.do_iodone_event = true;
 
-#ifdef CLUSTER_IMMEDIATE_NETIO
-        e->schedule_every(-CLUSTER_PERIOD);     // Negative event
-#else
-        e->schedule_every(-CLUSTER_PERIOD);
-#endif
-        cluster_periodic_event = e;
+        cluster_periodic_event = thread->schedule_every(this, -CLUSTER_PERIOD);
 
         // Startup the periodic events to process entries in
         //  external_incoming_control.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7b2bc024/iocore/cluster/P_ClusterHandler.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterHandler.h b/iocore/cluster/P_ClusterHandler.h
index 979de00..ec0fb22 100644
--- a/iocore/cluster/P_ClusterHandler.h
+++ b/iocore/cluster/P_ClusterHandler.h
@@ -465,6 +465,9 @@ struct ClusterHandler:public ClusterHandlerBase
     CLCON_READ_MSG,
     CLCON_READ_MSG_COMPLETE,
     CLCON_VALIDATE_MSG,
+    CLCON_CONN_BIND_CLEAR,
+    CLCON_CONN_BIND,
+    CLCON_CONN_BIND_OK,
     CLCON_ABORT_CONNECT,
     CLCON_DELETE_CONNECT
   } clcon_state_t;


[14/50] git commit: TS-1067 Remove InkSinglePipeInfo and turn it into a single queue

Posted by zw...@apache.org.
TS-1067 Remove InkSinglePipeInfo and turn it into a single queue


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

Branch: refs/heads/3.3.x
Commit: 39483b12897d11c2e22d8ea24d0c6b95e5b24c67
Parents: c3ebba3
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 11:07:14 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:52:33 2013 -0600

----------------------------------------------------------------------
 iocore/net/P_UDPNet.h    |   33 +--------------------------------
 iocore/net/UnixUDPNet.cc |   39 +++++++++++----------------------------
 proxy/Main.cc            |    4 ----
 3 files changed, 12 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/39483b12/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index 44917f2..bf0d67d 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -75,7 +75,6 @@ public:
   ink_hrtime last_report;
   ink_hrtime last_service;
   ink_hrtime last_byteperiod;
-  int bytesSent;
   int packets;
   int added;
 
@@ -343,36 +342,6 @@ get_UDPNetHandler(EThread * t)
 }
 
 // All of this stuff is for UDP egress b/w management
-struct InkSinglePipeInfo
-{
-  InkSinglePipeInfo()
-  {
-    wt = 0.0;
-    bwLimit = 0;
-    count = 0;
-    bytesSent = pktsSent = 0;
-    bwAlloc = 0;
-    bwUsed = 0.0;
-    queue = NEW(new PacketQueue());
-  };
-
-  ~InkSinglePipeInfo() {
-    delete queue;
-  }
-
-  double wt;
-  // all are in bps (bits per sec.) so that we can do ink_atomic_increment
-  int64_t bwLimit;
-  int64_t bwAlloc;
-  // this is in Mbps
-  double bwUsed;
-  IpAddr destIP;
-  uint32_t count;
-  uint64_t bytesSent;
-  uint64_t pktsSent;
-  PacketQueue *queue;
-};
-
-extern InkSinglePipeInfo G_inkPipeInfo;
+extern PacketQueue G_inkPipeInfo;
 
 #endif //__P_UDPNET_H_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/39483b12/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index e0e3cd7..fc94acc 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -59,7 +59,7 @@ int32_t g_udp_numSendRetries;
 // Public functions
 // See header for documentation
 //
-InkSinglePipeInfo G_inkPipeInfo;
+PacketQueue G_inkPipeInfo;
 
 int G_bwGrapherFd;
 sockaddr_in6 G_bwGrapherLoc;
@@ -630,7 +630,7 @@ Lerror:
 
 // send out all packets that need to be sent out as of time=now
 UDPQueue::UDPQueue()
-  : last_report(0), last_service(0), last_byteperiod(0), bytesSent(0), packets(0), added(0)
+  : last_report(0), last_service(0), last_byteperiod(0), packets(0), added(0)
 {
 }
 
@@ -710,7 +710,7 @@ UDPQueue::service(UDPNetHandler * nh)
       p->conn->nBytesTodo += pktLen;
 
       g_udp_bytesPending += pktLen;
-      G_inkPipeInfo.queue->addPacket(p, now);
+      G_inkPipeInfo.addPacket(p, now);
     }
   }
 
@@ -722,27 +722,11 @@ UDPQueue::service(UDPNetHandler * nh)
     lastPrintTime = now;
   }
 
-  G_inkPipeInfo.queue->advanceNow(now);
+  G_inkPipeInfo.advanceNow(now);
   SendPackets();
 
   timeSpent = ink_hrtime_to_msec(now - last_report);
   if (timeSpent > 10000) {
-    double bw, totalBw;
-
-    if (bytesSent > 0)
-      totalBw = (bytesSent * 8.0 * 1000.0) / (timeSpent * 1024.0 * 1024.0);
-    else
-      totalBw = 1.0;
-
-    // bw is in Mbps
-    bw = (G_inkPipeInfo.bytesSent * 8.0 * 1000.0) / (timeSpent * 1024.0 * 1024.0);
-
-    // use a weighted estimator of current usage
-    G_inkPipeInfo.bwUsed = (4.0 * G_inkPipeInfo.bwUsed / 5.0) + (bw / 5.0);
-    G_inkPipeInfo.bytesSent = 0;
-    G_inkPipeInfo.pktsSent = 0;
-
-    bytesSent = 0;
     last_report = now;
     added = 0;
     packets = 0;
@@ -792,10 +776,10 @@ UDPQueue::SendPackets()
 sendPackets:
   sentOne = false;
   send_threshold_time = now + SLOT_TIME;
-  bytesThisPipe = (int32_t) (bytesThisSlot * G_inkPipeInfo.wt);
+  bytesThisPipe = (int32_t)bytesThisSlot;
 
-  while ((bytesThisPipe > 0) && (G_inkPipeInfo.queue->firstPacket(send_threshold_time))) {
-    p = G_inkPipeInfo.queue->getFirstPacket();
+  while ((bytesThisPipe > 0) && (G_inkPipeInfo.firstPacket(send_threshold_time))) {
+    p = G_inkPipeInfo.getFirstPacket();
     pktLen = p->getPktLength();
     g_udp_bytesPending -= pktLen;
 
@@ -806,7 +790,6 @@ sendPackets:
     if (p->conn->GetSendGenerationNumber() != p->reqGenerationNum)
       goto next_pkt;
 
-    G_inkPipeInfo.bytesSent += pktLen;
     SendUDPPacket(p, pktLen);
     bytesUsed += pktLen;
     bytesThisPipe -= pktLen;
@@ -823,8 +806,8 @@ sendPackets:
   if ((bytesThisSlot > 0) && (sentOne)) {
     // redistribute the slack...
     now = ink_get_hrtime_internal();
-    if (G_inkPipeInfo.queue->firstPacket(now) == NULL) {
-      G_inkPipeInfo.queue->advanceNow(now);
+    if (G_inkPipeInfo.firstPacket(now) == NULL) {
+      G_inkPipeInfo.advanceNow(now);
     }
     goto sendPackets;
   }
@@ -834,7 +817,7 @@ sendPackets:
     uint64_t nbytes = g_udp_bytesPending;
     ink_hrtime startTime = ink_get_hrtime_internal(), endTime;
 
-    G_inkPipeInfo.queue->FreeCancelledPackets(g_udp_periodicCleanupSlots);
+    G_inkPipeInfo.FreeCancelledPackets(g_udp_periodicCleanupSlots);
     endTime = ink_get_hrtime_internal();
     Debug("udp-pending-packets", "Did cleanup of %d buckets: %" PRId64 " bytes in %" PRId64 " m.sec",
           g_udp_periodicCleanupSlots, nbytes - g_udp_bytesPending, (int64_t)ink_hrtime_to_msec(endTime - startTime));
@@ -864,7 +847,7 @@ UDPQueue::SendUDPPacket(UDPPacketInternal * p, int32_t pktLen)
   msg.msg_name = (caddr_t) & p->to;
   msg.msg_namelen = sizeof(p->to);
   iov_len = 0;
-  bytesSent += pktLen;
+
   for (b = p->chain; b != NULL; b = b->next) {
     iov[iov_len].iov_base = (caddr_t) b->start();
     iov[iov_len].iov_len = b->size();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/39483b12/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index dfde9c8..addbeeb 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -1521,10 +1521,6 @@ main(int argc, char **argv)
   TS_ReadConfigInteger(history_info_enabled, "proxy.config.history_info_enabled");
   TS_ReadConfigInteger(res_track_memory, "proxy.config.res_track_memory");
 
-  // This was the default when we had no bandwidth_mgmt.filename to load
-  // but I don't know for sure if we still need this.
-  G_inkPipeInfo.wt = 1.0;
-
   init_http_header();
 
   // Sanity checks


[17/50] git commit: TS-1067 Remove -UDPNetProcessor::UDPClassifyConnection class

Posted by zw...@apache.org.
TS-1067 Remove -UDPNetProcessor::UDPClassifyConnection class


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

Branch: refs/heads/3.3.x
Commit: 33d92c8d2404672fe642b9dacf04c6744b7a73b1
Parents: e486543
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 09:07:14 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:52:33 2013 -0600

----------------------------------------------------------------------
 iocore/net/I_UDPNet.h    |    3 ---
 iocore/net/UnixUDPNet.cc |   32 --------------------------------
 2 files changed, 0 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/33d92c8d/iocore/net/I_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPNet.h b/iocore/net/I_UDPNet.h
index 5497fbd..847e2c1 100644
--- a/iocore/net/I_UDPNet.h
+++ b/iocore/net/I_UDPNet.h
@@ -81,9 +81,6 @@ public:
   */
   inkcoreapi Action *UDPBind(Continuation * c, sockaddr const* addr, int send_bufsize = 0, int recv_bufsize = 0);
 
-  // The mess again: the complier won't let me stick UDPConnection here.
-  void UDPClassifyConnection(Continuation * udpConn, IpAddr const& addr);
-
   // Regarding sendto_re, sendmsg_re, recvfrom_re:
   // * You may be called back on 'c' with completion or error status.
   // * 'token' is an opaque which can be used by caller to match up the I/O

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/33d92c8d/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index 79dd8da..ccf1fde 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -575,38 +575,6 @@ HardError:
   return false;
 }
 
-void
-UDPNetProcessor::UDPClassifyConnection(
-  Continuation * udpConn,
-  IpAddr const& destIP
-) {
-  int i;
-  UDPConnectionInternal *p = static_cast<UDPConnectionInternal *>(udpConn);
-
-  if (G_inkPipeInfo.numPipes == 0) {
-    p->pipe_class = 0;
-    return;
-  }
-  p->pipe_class = -1;
-  // find a match: 0 is best-effort
-  for (i = 0; i < G_inkPipeInfo.numPipes + 1; i++)
-    if (G_inkPipeInfo.perPipeInfo[i].destIP == destIP)
-      p->pipe_class = i;
-  // no match; set it to the null class
-  if (p->pipe_class == -1) {
-    IpAddr null; // default constructed -> invalid value.
-    for (i = 0; i < G_inkPipeInfo.numPipes + 1; ++i)
-      if (G_inkPipeInfo.perPipeInfo[i].destIP == null) {
-        p->pipe_class = i;
-        break;
-      }
-  }
-  Debug("udpnet-pipe", "Pipe class = %d", p->pipe_class);
-  ink_debug_assert(p->pipe_class != -1);
-  if (p->pipe_class == -1)
-    p->pipe_class = 0;
-  G_inkPipeInfo.perPipeInfo[p->pipe_class].count++;
-}
 
 Action *
 UDPNetProcessor::UDPBind(Continuation * cont, sockaddr const* addr, int send_bufsize, int recv_bufsize)


[28/50] git commit: TS-1797 improve ClusterMachine::pop_ClusterHandler() when ts starting

Posted by zw...@apache.org.
TS-1797 improve ClusterMachine::pop_ClusterHandler() when ts starting


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

Branch: refs/heads/3.3.x
Commit: 25adb5cf4833a08de59f773095f4321920ecbaee
Parents: 86b17cc
Author: Chen Bin <ku...@taobao.com>
Authored: Wed Apr 3 11:17:22 2013 +0800
Committer: Chen Bin <ku...@taobao.com>
Committed: Wed Apr 3 11:17:22 2013 +0800

----------------------------------------------------------------------
 iocore/cluster/ClusterMachine.cc |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/25adb5cf/iocore/cluster/ClusterMachine.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterMachine.cc b/iocore/cluster/ClusterMachine.cc
index e4ac7df..a60839f 100644
--- a/iocore/cluster/ClusterMachine.cc
+++ b/iocore/cluster/ClusterMachine.cc
@@ -152,10 +152,17 @@ clusterHandlers(0)
 
 ClusterHandler *ClusterMachine::pop_ClusterHandler(int no_rr)
 {
+  int find = 0;
   int64_t now = rr_count;
   if (no_rr == 0) {
     ink_atomic_increment(&rr_count, 1);
   }
+
+  /* will happen when ts start (cluster connection is not established) */
+  while (!clusterHandlers[now % this->num_connections] && (find < this->num_connections)) {
+    now++;
+    find++;
+  }
   return this->clusterHandlers[now % this->num_connections];
 }
 


[21/50] git commit: TS-1067 More cleanup of unused code

Posted by zw...@apache.org.
TS-1067 More cleanup of unused code


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

Branch: refs/heads/3.3.x
Commit: 7a57cd365b412a3043f7ccc12410860e2cc4d357
Parents: 02bd9a7
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 21:59:11 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:53:42 2013 -0600

----------------------------------------------------------------------
 iocore/net/I_UDPPacket.h |   15 ++--
 iocore/net/P_UDPNet.h    |    4 -
 iocore/net/P_UDPPacket.h |   35 +--------
 iocore/net/UnixUDPNet.cc |  158 ++++++++++++++++-------------------------
 4 files changed, 70 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7a57cd36/iocore/net/I_UDPPacket.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPPacket.h b/iocore/net/I_UDPPacket.h
index 09826dc..08dfa88 100644
--- a/iocore/net/I_UDPPacket.h
+++ b/iocore/net/I_UDPPacket.h
@@ -45,24 +45,22 @@ class UDPPacket
 
 public:
 
-  virtual ~ UDPPacket()
-  {
-  };
-  virtual void free();          // fast deallocate
+  virtual ~UDPPacket()
+  { }
 
+  virtual void free();          // fast deallocate
   void setContinuation(Continuation * c);
   void setConnection(UDPConnection * c);
   UDPConnection *getConnection();
-  void setArrivalTime(ink_hrtime t);
   IOBufferBlock *getIOBlockChain();
   int64_t getPktLength();
+
   /**
      Add IOBufferBlock (chain) to end of packet.
      @param block block chain to add.
 
    */
   inkcoreapi void append_block(IOBufferBlock * block);
-  virtual void UDPPacket_is_abstract() = 0;
 
   IpEndpoint from;    // what address came from
   IpEndpoint to;      // what address to send to
@@ -94,8 +92,9 @@ extern UDPPacket *new_UDPPacket(struct sockaddr const* to, ink_hrtime when = 0,
    for packet
    @param len # of bytes to reference from block
  */
-extern UDPPacket *new_UDPPacket(struct sockaddr const* to,
-                                    ink_hrtime when = 0, IOBufferBlock * block = NULL, int len = 0);
+
+TS_INLINE UDPPacket *new_UDPPacket(struct sockaddr const* to, ink_hrtime when = 0,
+                                   IOBufferBlock * block = NULL, int len = 0);
 /**
    Create a new packet to be sent over UDPConnection.  Packet has no
    destination or data.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7a57cd36/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index 9c564f3..9cba1b3 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -70,7 +70,6 @@ public:
   // Interface exported to the outside world
   void send(UDPPacket * p);
 
-  Queue<UDPPacketInternal> reliabilityPktQueue;
   InkAtomicList atomicQueue;
   ink_hrtime last_report;
   ink_hrtime last_service;
@@ -81,8 +80,6 @@ public:
   ~UDPQueue();
 };
 
-#ifdef PACKETQUEUE_IMPL_AS_RING
-
 // 20 ms slots; 2048 slots  => 40 sec. into the future
 #define SLOT_TIME_MSEC 20
 #define SLOT_TIME HRTIME_MSECONDS(SLOT_TIME_MSEC)
@@ -296,7 +293,6 @@ private:
   void kill_cancelled_events()
   { }
 };
-#endif
 
 void initialize_thread_for_udp_net(EThread * thread);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7a57cd36/iocore/net/P_UDPPacket.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPPacket.h b/iocore/net/P_UDPPacket.h
index a93f083..f56e0b9 100644
--- a/iocore/net/P_UDPPacket.h
+++ b/iocore/net/P_UDPPacket.h
@@ -26,7 +26,6 @@
   P_UDPPacket.h
   Implementation of UDPPacket
 
-
  ****************************************************************************/
 
 
@@ -35,9 +34,6 @@
 
 #include "I_UDPNet.h"
 
-//#define PACKETQUEUE_IMPL_AS_PQLIST
-#define PACKETQUEUE_IMPL_AS_RING
-
 class UDPPacketInternal:public UDPPacket
 {
 
@@ -51,43 +47,32 @@ public:
 
   SLINK(UDPPacketInternal, alink);  // atomic link
   // packet scheduling stuff: keep it a doubly linked list
-  uint64_t pktSendStartTime;
-  uint64_t pktSendFinishTime;
   uint64_t pktLength;
 
   int reqGenerationNum;
   ink_hrtime delivery_time;   // when to deliver packet
-  ink_hrtime arrival_time;    // when packet arrived
 
   Ptr<IOBufferBlock> chain;
   Continuation *cont;         // callback on error
   UDPConnectionInternal *conn;        // connection where packet should be sent to.
 
-#if defined(PACKETQUEUE_IMPL_AS_PQLIST) || defined(PACKETQUEUE_IMPL_AS_RING)
   int in_the_priority_queue;
   int in_heap;
-#endif
-
-  virtual void UDPPacket_is_abstract() { }
 };
 
 inkcoreapi extern ClassAllocator<UDPPacketInternal> udpPacketAllocator;
 
 TS_INLINE
 UDPPacketInternal::UDPPacketInternal()
-  : pktSendStartTime(0), pktSendFinishTime(0), pktLength(0),
-    reqGenerationNum(0), delivery_time(0), arrival_time(0), cont(NULL) , conn(NULL)
-#if defined(PACKETQUEUE_IMPL_AS_PQLIST) || defined(PACKETQUEUE_IMPL_AS_RING)
-  ,in_the_priority_queue(0), in_heap(0)
-#endif
+  : pktLength(0), reqGenerationNum(0), delivery_time(0), cont(NULL),
+    conn(NULL), in_the_priority_queue(0), in_heap(0)
 {
   memset(&from, '\0', sizeof(from));
   memset(&to, '\0', sizeof(to));
 }
 
 TS_INLINE
-UDPPacketInternal::~
-UDPPacketInternal()
+UDPPacketInternal::~UDPPacketInternal()
 {
   chain = NULL;
 }
@@ -181,21 +166,13 @@ UDPPacket::getConnection(void)
   return ((UDPPacketInternal *) this)->conn;
 }
 
-TS_INLINE void
-UDPPacket::setArrivalTime(ink_hrtime t)
-{
-  ((UDPPacketInternal *) this)->arrival_time = t;
-}
-
 TS_INLINE UDPPacket *
 new_UDPPacket(struct sockaddr const* to, ink_hrtime when, char *buf, int len)
 {
   UDPPacketInternal *p = udpPacketAllocator.alloc();
 
-#if defined(PACKETQUEUE_IMPL_AS_PQLIST) || defined(PACKETQUEUE_IMPL_AS_RING)
   p->in_the_priority_queue = 0;
   p->in_heap = 0;
-#endif
   p->delivery_time = when;
   ats_ip_copy(&p->to, to);
 
@@ -217,10 +194,8 @@ new_UDPPacket(struct sockaddr const* to, ink_hrtime when, IOBufferBlock * buf, i
   UDPPacketInternal *p = udpPacketAllocator.alloc();
   IOBufferBlock *body;
 
-#if defined(PACKETQUEUE_IMPL_AS_PQLIST) || defined(PACKETQUEUE_IMPL_AS_RING)
   p->in_the_priority_queue = 0;
   p->in_heap = 0;
-#endif
   p->delivery_time = when;
   ats_ip_copy(&p->to, to);
 
@@ -237,10 +212,8 @@ new_UDPPacket(struct sockaddr const* to, ink_hrtime when, Ptr<IOBufferBlock> buf
 {
   UDPPacketInternal *p = udpPacketAllocator.alloc();
 
-#if defined(PACKETQUEUE_IMPL_AS_PQLIST) || defined(PACKETQUEUE_IMPL_AS_RING)
   p->in_the_priority_queue = 0;
   p->in_heap = 0;
-#endif
   p->delivery_time = when;
   if (to)
     ats_ip_copy(&p->to, to);
@@ -259,10 +232,8 @@ new_incoming_UDPPacket(struct sockaddr * from, char *buf, int len)
 {
   UDPPacketInternal *p = udpPacketAllocator.alloc();
 
-#if defined(PACKETQUEUE_IMPL_AS_PQLIST) || defined(PACKETQUEUE_IMPL_AS_RING)
   p->in_the_priority_queue = 0;
   p->in_heap = 0;
-#endif
   p->delivery_time = 0;
   ats_ip_copy(&p->from, from);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7a57cd36/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index a20c93f..fc9c31d 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -136,8 +136,6 @@ UDPNetProcessorInternal::udp_read_from_net(UDPNetHandler * nh,
     // create packet
     UDPPacket *p = new_incoming_UDPPacket(ats_ip_sa_cast(&fromaddr), buf, r);
     p->setConnection(uc);
-    // XXX: is this expensive?  I] really want to know this information
-    p->setArrivalTime(ink_get_hrtime_internal());
     // queue onto the UDPConnection
     ink_atomiclist_push(&uc->inQueue, p);
     iters++;
@@ -189,18 +187,21 @@ public:
   ~UDPReadContinuation();
   inline void free(void);
   inline void init_token(Event * completionToken);
+  inline void init_read(int fd, IOBufferBlock * buf, int len, struct sockaddr *fromaddr, socklen_t *fromaddrlen);
 
-  inline void init_read(int fd, IOBufferBlock * buf, int len, struct sockaddr *fromaddr, socklen_t *fromaddrlen);     // start up polling
   void set_timer(int seconds)
   {
     timeout_interval = HRTIME_SECONDS(seconds);
   }
+
   void cancel();
   int readPollEvent(int event, Event * e);
+
   Action *getAction()
   {
     return event;
   }
+
   void setupPollDescriptor();
 
 private:
@@ -222,8 +223,8 @@ ClassAllocator<UDPReadContinuation> udpReadContAllocator("udpReadContAllocator")
 #define UNINITIALIZED_EVENT_PTR (Event *)0xdeadbeef
 
 UDPReadContinuation::UDPReadContinuation(Event * completionToken)
-: Continuation(NULL), event(completionToken), readbuf(NULL),
-  readlen(0), fromaddrlen(0), fd(-1), ifd(-1), period(0), elapsed_time(0), timeout_interval(0)
+  : Continuation(NULL), event(completionToken), readbuf(NULL), readlen(0), fromaddrlen(0), fd(-1),
+    ifd(-1), period(0), elapsed_time(0), timeout_interval(0)
 {
   if (completionToken->continuation)
     this->mutex = completionToken->continuation->mutex;
@@ -232,10 +233,9 @@ UDPReadContinuation::UDPReadContinuation(Event * completionToken)
 }
 
 UDPReadContinuation::UDPReadContinuation()
-: Continuation(NULL), event(UNINITIALIZED_EVENT_PTR), readbuf(NULL),
-  readlen(0), fromaddrlen(0), fd(-1), ifd(-1), period(0), elapsed_time(0), timeout_interval(0)
-{
-}
+  : Continuation(NULL), event(UNINITIALIZED_EVENT_PTR), readbuf(NULL), readlen(0), fromaddrlen(0), fd(-1),
+    ifd(-1), period(0), elapsed_time(0), timeout_interval(0)
+{ }
 
 inline void
 UDPReadContinuation::free(void)
@@ -345,40 +345,39 @@ UDPReadContinuation::readPollEvent(int event_, Event * e)
   //ink_assert(ifd < 0 || event_ == EVENT_INTERVAL || (event_ == EVENT_POLL && pc->pollDescriptor->nfds > ifd && pc->pollDescriptor->pfd[ifd].fd == fd));
   //if (ifd < 0 || event_ == EVENT_INTERVAL || (pc->pollDescriptor->pfd[ifd].revents & POLLIN)) {
   ink_debug_assert(!"incomplete");
+  c = completionUtil::getContinuation(event);
+  // do read
+  socklen_t tmp_fromlen = *fromaddrlen;
+  int rlen = socketManager.recvfrom(fd, readbuf->end(), readlen, 0, ats_ip_sa_cast(fromaddr), &tmp_fromlen);
+
+  completionUtil::setThread(event, e->ethread);
+  // call back user with their event
+  if (rlen > 0) {
+    // do callback if read is successful
+    *fromaddrlen = tmp_fromlen;
+    completionUtil::setInfo(event, fd, readbuf, rlen, errno);
+    readbuf->fill(rlen);
+    // TODO: Should we deal with the return code?
+    c->handleEvent(NET_EVENT_DATAGRAM_READ_COMPLETE, event);
+    e->cancel();
+    free();
+    // delete this;
+    return EVENT_DONE;
+  } else if (rlen < 0 && rlen != -EAGAIN) {
+    // signal error.
+    *fromaddrlen = tmp_fromlen;
+    completionUtil::setInfo(event, fd, (IOBufferBlock *) readbuf, rlen, errno);
     c = completionUtil::getContinuation(event);
-    // do read
-    socklen_t tmp_fromlen = *fromaddrlen;
-    int rlen = socketManager.recvfrom(fd, readbuf->end(), readlen,
-                                      0,        // default flags
-                                      ats_ip_sa_cast(fromaddr), &tmp_fromlen);
-    completionUtil::setThread(event, e->ethread);
-    // call back user with their event
-    if (rlen > 0) {
-      // do callback if read is successful
-      *fromaddrlen = tmp_fromlen;
-      completionUtil::setInfo(event, fd, readbuf, rlen, errno);
-      readbuf->fill(rlen);
-      // TODO: Should we deal with the return code?
-      c->handleEvent(NET_EVENT_DATAGRAM_READ_COMPLETE, event);
-      e->cancel();
-      free();
-      // delete this;
-      return EVENT_DONE;
-    } else if (rlen < 0 && rlen != -EAGAIN) {
-      // signal error.
-      *fromaddrlen = tmp_fromlen;
-      completionUtil::setInfo(event, fd, (IOBufferBlock *) readbuf, rlen, errno);
-      c = completionUtil::getContinuation(event);
-      // TODO: Should we deal with the return code?
-      c->handleEvent(NET_EVENT_DATAGRAM_READ_ERROR, event);
-      e->cancel();
-      free();
-      //delete this;
-      return EVENT_DONE;
-    } else {
-      completionUtil::setThread(event, NULL);
-    }
-//}
+    // TODO: Should we deal with the return code?
+    c->handleEvent(NET_EVENT_DATAGRAM_READ_ERROR, event);
+    e->cancel();
+    free();
+    //delete this;
+    return EVENT_DONE;
+  } else {
+    completionUtil::setThread(event, NULL);
+  }
+
   if (event->cancelled) {
     e->cancel();
     free();
@@ -417,10 +416,11 @@ UDPNetProcessor::recvfrom_re(Continuation * cont,
   ink_assert(buf->write_avail() >= len);
   int actual;
   Event *event = completionUtil::create();
+
   completionUtil::setContinuation(event, cont);
   completionUtil::setHandle(event, token);
-  actual = socketManager.recvfrom(fd, buf->end(), len, 0,       // default flags
-                                  fromaddr, fromaddrlen);
+  actual = socketManager.recvfrom(fd, buf->end(), len, 0, fromaddr, fromaddrlen);
+
   if (actual > 0) {
     completionUtil::setThread(event, this_ethread());
     completionUtil::setInfo(event, fd, buf, actual, errno);
@@ -458,6 +458,7 @@ UDPNetProcessor::sendmsg_re(Continuation * cont, void *token, int fd, struct msg
 {
   int actual;
   Event *event = completionUtil::create();
+
   completionUtil::setContinuation(event, cont);
   completionUtil::setHandle(event, token);
 
@@ -489,13 +490,13 @@ UDPNetProcessor::sendmsg_re(Continuation * cont, void *token, int fd, struct msg
  *
  */
 Action *
-UDPNetProcessor::sendto_re(Continuation * cont,
-                           void *token, int fd, struct sockaddr const* toaddr, int toaddrlen, IOBufferBlock * buf, int len)
+UDPNetProcessor::sendto_re(Continuation * cont, void *token, int fd, struct sockaddr const* toaddr, int toaddrlen,
+                           IOBufferBlock * buf, int len)
 {
   (void) token;
   ink_assert(buf->read_avail() >= len);
-  int nbytes_sent = socketManager.sendto(fd, buf->start(), len, 0,
-                                         toaddr, toaddrlen);
+  int nbytes_sent = socketManager.sendto(fd, buf->start(), len, 0, toaddr, toaddrlen);
+
   if (nbytes_sent >= 0) {
     ink_assert(nbytes_sent == len);
     buf->consume(nbytes_sent);
@@ -509,14 +510,9 @@ UDPNetProcessor::sendto_re(Continuation * cont,
 
 
 bool
-UDPNetProcessor::CreateUDPSocket(
-  int *resfd,
-  sockaddr const* remote_addr,
-  sockaddr* local_addr,
-  int *local_addr_len,
-  Action ** status, 
-  int send_bufsize, int recv_bufsize
-) {
+UDPNetProcessor::CreateUDPSocket(int *resfd, sockaddr const* remote_addr, sockaddr* local_addr,
+                                 int *local_addr_len, Action ** status, int send_bufsize, int recv_bufsize)
+{
   int res = 0, fd = -1;
 
   ink_assert(ats_ip_are_compatible(remote_addr, local_addr));
@@ -630,15 +626,10 @@ Lerror:
 // send out all packets that need to be sent out as of time=now
 UDPQueue::UDPQueue()
   : last_report(0), last_service(0), packets(0), added(0)
-{
-}
+{ }
 
 UDPQueue::~UDPQueue()
 {
-  UDPPacketInternal *p;
-
-  while ((p = reliabilityPktQueue.dequeue()) != NULL)
-    p->free();
 }
 
 /*
@@ -647,26 +638,18 @@ UDPQueue::~UDPQueue()
 void
 UDPQueue::service(UDPNetHandler * nh)
 {
+  (void) nh;
   ink_hrtime now = ink_get_hrtime_internal();
   uint64_t timeSpent = 0;
+  uint64_t pktSendStartTime;
   UDPPacketInternal *p;
   ink_hrtime pktSendTime;
   double minPktSpacing;
   uint32_t pktSize;
   int64_t pktLen;
 
-  (void) nh;
-  static ink_hrtime lastPrintTime = ink_get_hrtime_internal();
-  static ink_hrtime lastSchedTime = ink_get_hrtime_internal();
-  static uint32_t schedJitter = 0;
-  static uint32_t numTimesSched = 0;
-
-  schedJitter += ink_hrtime_to_msec(now - lastSchedTime);
-  numTimesSched++;
-
   p = (UDPPacketInternal *) ink_atomiclist_popall(&atomicQueue);
   if (p) {
-
     UDPPacketInternal *pnext = NULL;
     Queue<UDPPacketInternal> stk;
 
@@ -676,6 +659,7 @@ UDPQueue::service(UDPNetHandler * nh)
       stk.push(p);
       p = pnext;
     }
+
     // walk backwards down list since this is actually an atomic stack.
     while (stk.head) {
       p = stk.pop();
@@ -685,27 +669,20 @@ UDPQueue::service(UDPNetHandler * nh)
       Debug("udp-send", "Adding %p", p);
       pktLen = p->getPktLength();
       if (p->conn->lastPktStartTime == 0) {
-        p->pktSendStartTime = MAX(now, p->delivery_time);
+        pktSendStartTime = MAX(now, p->delivery_time);
       } else {
         pktSize = MAX(INK_ETHERNET_MTU_SIZE, pktLen);
         minPktSpacing = 0.0;
         pktSendTime = p->delivery_time;
-        p->pktSendStartTime = MAX(MAX(now, pktSendTime), p->delivery_time);
+        pktSendStartTime = MAX(MAX(now, pktSendTime), p->delivery_time);
       }
-      p->conn->lastPktStartTime = p->pktSendStartTime;
-      p->delivery_time = p->pktSendStartTime;
+      p->conn->lastPktStartTime = pktSendStartTime;
+      p->delivery_time = pktSendStartTime;
 
       G_inkPipeInfo.addPacket(p, now);
     }
   }
 
-  if ((now - lastPrintTime) > ink_hrtime_from_sec(30)) {
-    Debug("udp-sched-jitter", "avg. udp sched jitter: %f", (double) schedJitter / numTimesSched);
-    schedJitter = 0;
-    numTimesSched = 0;
-    lastPrintTime = now;
-  }
-
   G_inkPipeInfo.advanceNow(now);
   SendPackets();
 
@@ -733,21 +710,6 @@ UDPQueue::SendPackets()
   if (now > last_service)
     timeDelta = ink_hrtime_to_msec(now - last_service);
 
-  while ((p = reliabilityPktQueue.dequeue()) != NULL) {
-    pktLen = p->getPktLength();
-    if (p->conn->shouldDestroy())
-      goto next_pkt_3;
-    if (p->conn->GetSendGenerationNumber() != p->reqGenerationNum)
-      goto next_pkt_3;
-
-    SendUDPPacket(p, pktLen);
-    bytesThisSlot -= pktLen;
-    if (bytesThisSlot < 0)
-      break;
-  next_pkt_3:
-    p->free();
-  }
-
   bytesThisSlot = INT_MAX;
 
 sendPackets:


[20/50] git commit: TS-1067 Fix the global variable that we read periodic_cleanup into.

Posted by zw...@apache.org.
TS-1067 Fix the global variable that we read periodic_cleanup into.


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

Branch: refs/heads/3.3.x
Commit: 20dacb06b94c276f157e57370d66fc663649ba5b
Parents: 7a57cd3
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 22:21:07 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:53:42 2013 -0600

----------------------------------------------------------------------
 iocore/net/UnixUDPNet.cc |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/20dacb06/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index fc9c31d..446e349 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -69,16 +69,14 @@ initialize_thread_for_udp_net(EThread * thread)
   new((ink_dummy_for_new *) get_UDPPollCont(thread)) PollCont(thread->mutex);
   new((ink_dummy_for_new *) get_UDPNetHandler(thread)) UDPNetHandler;
 
-  // These are hidden variables that control the amount of memory used by UDP
-  // packets.  As usual, defaults are in RecordsConfig.cc
-
   // This variable controls how often we cleanup the cancelled packets.
   // If it is set to 0, then cleanup never occurs.
   REC_ReadConfigInt32(g_udp_periodicFreeCancelledPkts, "proxy.config.udp.free_cancelled_pkts_sec");
+
   // This variable controls how many "slots" of the udp calendar queue we cleanup.
   // If it is set to 0, then cleanup never occurs.  This value makes sense
   // only if the above variable is set.
-  REC_ReadConfigInt32(g_udp_periodicFreeCancelledPkts, "proxy.config.udp.periodic_cleanup");
+  REC_ReadConfigInt32(g_udp_periodicCleanupSlots, "proxy.config.udp.periodic_cleanup");
 
   // UDP sends can fail with errno=EAGAIN.  This variable determines the # of
   // times the UDP thread retries before giving up.  Set to 0 to keep trying forever.


[31/50] git commit: TS-1067 Fix the code around the proxy.config.udp.theads option

Posted by zw...@apache.org.
TS-1067 Fix the code around the proxy.config.udp.theads option


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

Branch: refs/heads/3.3.x
Commit: ce3ab8ce56ad505dd7584312bb0d309e0879f004
Parents: c95298d
Author: Leif Hedstrom <zw...@apache.org>
Authored: Wed Apr 3 10:14:11 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Wed Apr 3 10:14:11 2013 -0600

----------------------------------------------------------------------
 proxy/Main.cc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ce3ab8ce/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 05c3bc4..9cff6f3 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -1639,7 +1639,7 @@ main(int argc, char **argv)
 
     // UDP net-threads are turned off by default.
     if (!num_of_udp_threads)
-      TS_ReadConfigInteger(num_of_udp_threads, "proxy.config.ssl.number.threads");
+      TS_ReadConfigInteger(num_of_udp_threads, "proxy.config.udp.threads");
     if (num_of_udp_threads)
       udpNet.start(num_of_udp_threads);
 


[10/50] git commit: TS-1067 Remove more stats counting that is not needed anymore

Posted by zw...@apache.org.
TS-1067 Remove more stats counting that is not needed anymore


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

Branch: refs/heads/3.3.x
Commit: 7779ba629d8d62264fd06a4b57039f645eee2ca6
Parents: 39483b1
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 14:38:37 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:52:33 2013 -0600

----------------------------------------------------------------------
 iocore/net/P_UDPConnection.h |   23 +----------------------
 iocore/net/UnixUDPNet.cc     |   13 -------------
 2 files changed, 1 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7779ba62/iocore/net/P_UDPConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPConnection.h b/iocore/net/P_UDPConnection.h
index aacea6d..7cc7c33 100644
--- a/iocore/net/P_UDPConnection.h
+++ b/iocore/net/P_UDPConnection.h
@@ -60,38 +60,17 @@ public:
   // the same as the lastSentPktStartTime.
   uint64_t lastSentPktStartTime;
   uint64_t lastPktStartTime;
-  int32_t pipe_class;
-  uint32_t nBytesDone;
-  uint32_t nBytesTodo;
-  // flow rate in Bytes per sec.
-  double flowRateBps;
-  double avgPktSize;
-  int64_t allocedbps;
-
-  //this class is abstract
 };
 
 TS_INLINE
 UDPConnectionInternal::UDPConnectionInternal()
-  : continuation(NULL)
-  , recvActive(0)
-  , refcount(0)
-  , fd(-1)
-  , binding_valid(0)
-  , tobedestroyed(0)
-  , nBytesDone(0)
-  , nBytesTodo(0)
+  : continuation(NULL), recvActive(0), refcount(0), fd(-1), binding_valid(0), tobedestroyed(0)
 {
   sendGenerationNum = 0;
   lastSentPktTSSeqNum = -1;
   lastSentPktStartTime = 0;
   lastPktStartTime = 0;
-  pipe_class = 0;
-  flowRateBps = 0.0;
-  avgPktSize = 0.0;
-  allocedbps = 0;
   memset(&binding, 0, sizeof binding);
-  //SET_HANDLER(&BaseUDPConnection::callbackHandler);
 }
 
 TS_INLINE

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7779ba62/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index fc94acc..c1e839d 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -696,18 +696,9 @@ UDPQueue::service(UDPNetHandler * nh)
         minPktSpacing = 0.0;
         pktSendTime = p->delivery_time;
         p->pktSendStartTime = MAX(MAX(now, pktSendTime), p->delivery_time);
-        if (p->conn->flowRateBps > 25600.0)
-          Debug("udpnet-pkt", "Pkt size = %.1lf now = %" PRId64 ", send = %" PRId64 ", del = %" PRId64 ", Delay delta = %" PRId64 "; delta = %" PRId64 "",
-                p->conn->avgPktSize,
-                now, pktSendTime, p->delivery_time,
-                ink_hrtime_to_msec(p->pktSendStartTime - now),
-                ink_hrtime_to_msec(p->pktSendStartTime - p->conn->lastPktStartTime));
-
-        p->conn->avgPktSize = ((4.0 * p->conn->avgPktSize) / 5.0) + (pktSize / 5.0);
       }
       p->conn->lastPktStartTime = p->pktSendStartTime;
       p->delivery_time = p->pktSendStartTime;
-      p->conn->nBytesTodo += pktLen;
 
       g_udp_bytesPending += pktLen;
       G_inkPipeInfo.addPacket(p, now);
@@ -754,8 +745,6 @@ UDPQueue::SendPackets()
   while ((p = reliabilityPktQueue.dequeue()) != NULL) {
     pktLen = p->getPktLength();
     g_udp_bytesPending -= pktLen;
-
-    p->conn->nBytesTodo -= pktLen;
     p->conn->nBytesDone += pktLen;
 
     if (p->conn->shouldDestroy())
@@ -783,8 +772,6 @@ sendPackets:
     pktLen = p->getPktLength();
     g_udp_bytesPending -= pktLen;
 
-    p->conn->nBytesTodo -= pktLen;
-    p->conn->nBytesDone += pktLen;
     if (p->conn->shouldDestroy())
       goto next_pkt;
     if (p->conn->GetSendGenerationNumber() != p->reqGenerationNum)


[25/50] git commit: TS-1787 Eliminate old ink_time code (was probably only used by the now obsolete Web UI). This fixes compiling with gcc 4.8 as well.

Posted by zw...@apache.org.
TS-1787 Eliminate old ink_time code (was probably only used by the
now obsolete Web UI). This fixes compiling with gcc 4.8 as well.


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

Branch: refs/heads/3.3.x
Commit: 16a2305ac17748634b69a38cd3df47c66291ab8c
Parents: ce893d7
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Apr 2 16:55:58 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 16:55:58 2013 -0600

----------------------------------------------------------------------
 CHANGES |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/16a2305a/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 70e5bff..b8321b1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-1787] Eliminate old ink_time code (was probably only used by the
+   now obsolete Web UI). This fixes compiling with gcc 4.8 as well.
+
   *) [TS-1067] Remove unused config (and code) for bandwidth management.
 
   *) [TS-1736] Fatal() terminates process without a backtrace


[09/50] git commit: TS-1067 Remove a number of unused member variables

Posted by zw...@apache.org.
TS-1067 Remove a number of unused member variables


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

Branch: refs/heads/3.3.x
Commit: 02bd9a7e7337a61236c87f26ac908e0711133e23
Parents: 7779ba6
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 20:24:45 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:52:33 2013 -0600

----------------------------------------------------------------------
 iocore/net/I_UDPPacket.h |    1 -
 iocore/net/P_UDPNet.h    |   48 +++++++++++++++++++---------------------
 iocore/net/P_UDPPacket.h |   23 +------------------
 iocore/net/UnixUDPNet.cc |   34 +++++-----------------------
 4 files changed, 30 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/02bd9a7e/iocore/net/I_UDPPacket.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPPacket.h b/iocore/net/I_UDPPacket.h
index ec50b9e..09826dc 100644
--- a/iocore/net/I_UDPPacket.h
+++ b/iocore/net/I_UDPPacket.h
@@ -55,7 +55,6 @@ public:
   UDPConnection *getConnection();
   void setArrivalTime(ink_hrtime t);
   IOBufferBlock *getIOBlockChain();
-  void setReliabilityPkt();
   int64_t getPktLength();
   /**
      Add IOBufferBlock (chain) to end of packet.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/02bd9a7e/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index bf0d67d..9c564f3 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -63,7 +63,7 @@ class UDPQueue
 public:
 
   void service(UDPNetHandler *);
-  // In the absence of bulk-io, we are down sending packet after packet
+
   void SendPackets();
   void SendUDPPacket(UDPPacketInternal * p, int32_t pktLen);
 
@@ -74,7 +74,6 @@ public:
   InkAtomicList atomicQueue;
   ink_hrtime last_report;
   ink_hrtime last_service;
-  ink_hrtime last_byteperiod;
   int packets;
   int added;
 
@@ -89,24 +88,20 @@ public:
 #define SLOT_TIME HRTIME_MSECONDS(SLOT_TIME_MSEC)
 #define N_SLOTS 2048
 
-extern uint64_t g_udp_bytesPending;
-
 class PacketQueue
 {
 public:
   PacketQueue()
-  :nPackets(0)
-  , now_slot(0)
+    : nPackets(0), now_slot(0)
   {
     lastPullLongTermQ = 0;
     init();
   }
 
   virtual ~ PacketQueue()
-  {
-  }
-  int nPackets;
+  { }
 
+  int nPackets;
   ink_hrtime lastPullLongTermQ;
   Queue<UDPPacketInternal> longTermQ;
   Queue<UDPPacketInternal> bucket[N_SLOTS];
@@ -126,12 +121,12 @@ public:
     }
   }
 
-  void addPacket(UDPPacketInternal * e, ink_hrtime now = 0) {
+  void addPacket(UDPPacketInternal * e, ink_hrtime now = 0)
+  {
     int before = 0;
     int slot;
 
     if (IsCancelledPacket(e)) {
-      g_udp_bytesPending -= e->getPktLength();
       e->free();
       return;
     }
@@ -168,7 +163,8 @@ public:
     e->in_the_priority_queue = 1;
     e->in_heap = slot;
     bucket[slot].enqueue(e);
-  };
+  }
+
   UDPPacketInternal *firstPacket(ink_hrtime t)
   {
     if (t > delivery_time[now_slot]) {
@@ -176,23 +172,25 @@ public:
     } else {
       return NULL;
     }
-  };
+  }
+
   UDPPacketInternal *getFirstPacket()
   {
     nPackets--;
     return dequeue_ready(0);
-  };
+  }
+
   int size()
   {
     ink_assert(nPackets >= 0);
     return nPackets;
-  };
+  }
 
   bool IsCancelledPacket(UDPPacketInternal * p)
   {
     // discard packets that'll never get sent...
     return ((p->conn->shouldDestroy()) || (p->conn->GetSendGenerationNumber() != p->reqGenerationNum));
-  };
+  }
 
   void FreeCancelledPackets(int numSlots)
   {
@@ -204,7 +202,6 @@ public:
       s = (now_slot + i) % N_SLOTS;
       while (NULL != (p = bucket[s].dequeue())) {
         if (IsCancelledPacket(p)) {
-          g_udp_bytesPending -= p->getPktLength();
           p->free();
           continue;
         }
@@ -215,7 +212,7 @@ public:
         bucket[s].enqueue(p);
       }
     }
-  };
+  }
 
   void advanceNow(ink_hrtime t)
   {
@@ -254,7 +251,8 @@ public:
       Debug("udpnet-service", "Advancing by (%d slots): behind by %" PRId64 " ms",
             s - now_slot, ink_hrtime_to_msec(t - delivery_time[now_slot]));
     now_slot = s;
-  };
+  }
+
 private:
   void remove(UDPPacketInternal * e)
   {
@@ -265,7 +263,8 @@ private:
   }
 
 public:
-  UDPPacketInternal * dequeue_ready(ink_hrtime t) {
+  UDPPacketInternal *dequeue_ready(ink_hrtime t)
+  {
     (void) t;
     UDPPacketInternal *e = bucket[now_slot].dequeue();
     if (e) {
@@ -295,8 +294,7 @@ public:
 
 private:
   void kill_cancelled_events()
-  {
-  }
+  { }
 };
 #endif
 
@@ -331,17 +329,17 @@ struct PollCont;
 static inline PollCont *
 get_UDPPollCont(EThread * t)
 {
-  return (PollCont *) ETHREAD_GET_PTR(t, udpNetInternal.pollCont_offset);
+  return (PollCont *)ETHREAD_GET_PTR(t, udpNetInternal.pollCont_offset);
 }
 
 static inline UDPNetHandler *
 get_UDPNetHandler(EThread * t)
 {
-  return (UDPNetHandler *)
-    ETHREAD_GET_PTR(t, udpNetInternal.udpNetHandler_offset);
+  return (UDPNetHandler *)ETHREAD_GET_PTR(t, udpNetInternal.udpNetHandler_offset);
 }
 
 // All of this stuff is for UDP egress b/w management
+// ToDo: It'd be nice to eliminate this entirely.... But we have no working use of UDPNet afaik. /leif
 extern PacketQueue G_inkPipeInfo;
 
 #endif //__P_UDPNET_H_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/02bd9a7e/iocore/net/P_UDPPacket.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPPacket.h b/iocore/net/P_UDPPacket.h
index 0a0d1a8..a93f083 100644
--- a/iocore/net/P_UDPPacket.h
+++ b/iocore/net/P_UDPPacket.h
@@ -45,7 +45,6 @@ public:
   UDPPacketInternal();
   virtual ~ UDPPacketInternal();
 
-  void append_bytes(char *buf, int len);
   void append_block_internal(IOBufferBlock * block);
 
   virtual void free();
@@ -56,8 +55,6 @@ public:
   uint64_t pktSendFinishTime;
   uint64_t pktLength;
 
-  bool isReliabilityPkt;
-
   int reqGenerationNum;
   ink_hrtime delivery_time;   // when to deliver packet
   ink_hrtime arrival_time;    // when packet arrived
@@ -78,7 +75,7 @@ inkcoreapi extern ClassAllocator<UDPPacketInternal> udpPacketAllocator;
 
 TS_INLINE
 UDPPacketInternal::UDPPacketInternal()
-  : pktSendStartTime(0), pktSendFinishTime(0), pktLength(0), isReliabilityPkt(false),
+  : pktSendStartTime(0), pktSendFinishTime(0), pktLength(0),
     reqGenerationNum(0), delivery_time(0), arrival_time(0), cont(NULL) , conn(NULL)
 #if defined(PACKETQUEUE_IMPL_AS_PQLIST) || defined(PACKETQUEUE_IMPL_AS_RING)
   ,in_the_priority_queue(0), in_heap(0)
@@ -106,24 +103,6 @@ UDPPacketInternal::free()
 }
 
 TS_INLINE void
-UDPPacketInternal::append_bytes(char *buf, int len)
-{
-  IOBufferData *d = NULL;
-  if (buf) {
-    d = new_xmalloc_IOBufferData(buf, len);
-    append_block(new_IOBufferBlock(d, len));
-  }
-}
-
-TS_INLINE void
-UDPPacket::setReliabilityPkt()
-{
-  UDPPacketInternal *p = (UDPPacketInternal *) this;
-
-  p->isReliabilityPkt = true;
-}
-
-TS_INLINE void
 UDPPacket::append_block(IOBufferBlock * block)
 {
   UDPPacketInternal *p = (UDPPacketInternal *) this;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/02bd9a7e/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index c1e839d..a20c93f 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -48,7 +48,6 @@ EventType ET_UDP;
 UDPNetProcessorInternal udpNetInternal;
 UDPNetProcessor &udpNet = udpNetInternal;
 
-uint64_t g_udp_bytesPending;
 int32_t g_udp_periodicCleanupSlots;
 int32_t g_udp_periodicFreeCancelledPkts;
 int32_t g_udp_numSendRetries;
@@ -630,7 +629,7 @@ Lerror:
 
 // send out all packets that need to be sent out as of time=now
 UDPQueue::UDPQueue()
-  : last_report(0), last_service(0), last_byteperiod(0), packets(0), added(0)
+  : last_report(0), last_service(0), packets(0), added(0)
 {
 }
 
@@ -682,10 +681,6 @@ UDPQueue::service(UDPNetHandler * nh)
       p = stk.pop();
       ink_assert(p->link.prev == NULL);
       ink_assert(p->link.next == NULL);
-      if (p->isReliabilityPkt) {
-        reliabilityPktQueue.enqueue(p);
-        continue;
-      }
       // insert into our queue.
       Debug("udp-send", "Adding %p", p);
       pktLen = p->getPktLength();
@@ -700,13 +695,11 @@ UDPQueue::service(UDPNetHandler * nh)
       p->conn->lastPktStartTime = p->pktSendStartTime;
       p->delivery_time = p->pktSendStartTime;
 
-      g_udp_bytesPending += pktLen;
       G_inkPipeInfo.addPacket(p, now);
     }
   }
 
   if ((now - lastPrintTime) > ink_hrtime_from_sec(30)) {
-    Debug("udp-pending-packets", "udp bytes pending: %" PRId64 "", g_udp_bytesPending);
     Debug("udp-sched-jitter", "avg. udp sched jitter: %f", (double) schedJitter / numTimesSched);
     schedJitter = 0;
     numTimesSched = 0;
@@ -731,8 +724,6 @@ UDPQueue::SendPackets()
   UDPPacketInternal *p;
   static ink_hrtime lastCleanupTime = ink_get_hrtime_internal();
   ink_hrtime now = ink_get_hrtime_internal();
-  // ink_hrtime send_threshold_time = now + HRTIME_MSECONDS(5);
-  // send packets for SLOT_TIME per attempt
   ink_hrtime send_threshold_time = now + SLOT_TIME;
   int32_t bytesThisSlot = INT_MAX, bytesUsed = 0;
   int32_t bytesThisPipe, sentOne;
@@ -744,9 +735,6 @@ UDPQueue::SendPackets()
 
   while ((p = reliabilityPktQueue.dequeue()) != NULL) {
     pktLen = p->getPktLength();
-    g_udp_bytesPending -= pktLen;
-    p->conn->nBytesDone += pktLen;
-
     if (p->conn->shouldDestroy())
       goto next_pkt_3;
     if (p->conn->GetSendGenerationNumber() != p->reqGenerationNum)
@@ -770,7 +758,6 @@ sendPackets:
   while ((bytesThisPipe > 0) && (G_inkPipeInfo.firstPacket(send_threshold_time))) {
     p = G_inkPipeInfo.getFirstPacket();
     pktLen = p->getPktLength();
-    g_udp_bytesPending -= pktLen;
 
     if (p->conn->shouldDestroy())
       goto next_pkt;
@@ -790,7 +777,7 @@ sendPackets:
 
   bytesThisSlot -= bytesUsed;
 
-  if ((bytesThisSlot > 0) && (sentOne)) {
+  if ((bytesThisSlot > 0) && sentOne) {
     // redistribute the slack...
     now = ink_get_hrtime_internal();
     if (G_inkPipeInfo.firstPacket(now) == NULL) {
@@ -799,15 +786,8 @@ sendPackets:
     goto sendPackets;
   }
 
-  if ((g_udp_periodicFreeCancelledPkts) &&
-      (now - lastCleanupTime > ink_hrtime_from_sec(g_udp_periodicFreeCancelledPkts))) {
-    uint64_t nbytes = g_udp_bytesPending;
-    ink_hrtime startTime = ink_get_hrtime_internal(), endTime;
-
+  if ((g_udp_periodicFreeCancelledPkts) && (now - lastCleanupTime > ink_hrtime_from_sec(g_udp_periodicFreeCancelledPkts))) {
     G_inkPipeInfo.FreeCancelledPackets(g_udp_periodicCleanupSlots);
-    endTime = ink_get_hrtime_internal();
-    Debug("udp-pending-packets", "Did cleanup of %d buckets: %" PRId64 " bytes in %" PRId64 " m.sec",
-          g_udp_periodicCleanupSlots, nbytes - g_udp_bytesPending, (int64_t)ink_hrtime_to_msec(endTime - startTime));
     lastCleanupTime = now;
   }
 }
@@ -821,11 +801,9 @@ UDPQueue::SendUDPPacket(UDPPacketInternal * p, int32_t pktLen)
   int real_len = 0;
   int n, count, iov_len = 0;
 
-  if (!p->isReliabilityPkt) {
-    p->conn->lastSentPktStartTime = p->delivery_time;
-  }
-
+  p->conn->lastSentPktStartTime = p->delivery_time;
   Debug("udp-send", "Sending %p", p);
+
 #if !defined(solaris)
   msg.msg_control = 0;
   msg.msg_controllen = 0;
@@ -852,7 +830,7 @@ UDPQueue::SendUDPPacket(UDPPacketInternal * p, int32_t pktLen)
       // send succeeded or some random error happened.
       break;
     if (errno == EAGAIN) {
-      count++;
+      ++count;
       if ((g_udp_numSendRetries > 0) && (count >= g_udp_numSendRetries)) {
         // tried too many times; give up
         Debug("udpnet", "Send failed: too many retries");


[06/50] git commit: TS-1766: add TCL libs to unit tests

Posted by zw...@apache.org.
TS-1766: add TCL libs to unit tests


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

Branch: refs/heads/3.3.x
Commit: 3f905d527b1ae73e241f1a174f0d0b0853029590
Parents: 2918fc1
Author: James Peach <jp...@apache.org>
Authored: Tue Apr 2 11:50:09 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Tue Apr 2 11:50:09 2013 -0700

----------------------------------------------------------------------
 iocore/eventsystem/Makefile.am |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3f905d52/iocore/eventsystem/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/Makefile.am b/iocore/eventsystem/Makefile.am
index 59a8a24..1eac3d1 100644
--- a/iocore/eventsystem/Makefile.am
+++ b/iocore/eventsystem/Makefile.am
@@ -89,7 +89,8 @@ test_LDADD = \
   $(top_builddir)/mgmt/libmgmt_p.a \
   $(top_builddir)/mgmt/utils/libutils_p.a \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
-  $(top_builddir)/lib/ts/libtsutil.la
+  $(top_builddir)/lib/ts/libtsutil.la \
+  @LIBTCL@
 
 test_Buffer_SOURCES = ../../proxy/UglyLogStubs.cc test_Buffer.cc
 test_Event_SOURCES = ../../proxy/UglyLogStubs.cc test_Event.cc


[16/50] git commit: TS-1067 Reduce to one UDP pipe, and remove BulkIOSend()

Posted by zw...@apache.org.
TS-1067 Reduce to one UDP pipe, and remove BulkIOSend()


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

Branch: refs/heads/3.3.x
Commit: e669312fe62a46164457e8b515651795e6cbd607
Parents: 33d92c8
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 09:48:36 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:52:33 2013 -0600

----------------------------------------------------------------------
 iocore/net/P_LibBulkIO.h |    2 -
 iocore/net/P_UDPNet.h    |    6 --
 iocore/net/UnixUDPNet.cc |  154 +++++++++++------------------------------
 proxy/Main.cc            |    2 -
 4 files changed, 40 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e669312f/iocore/net/P_LibBulkIO.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_LibBulkIO.h b/iocore/net/P_LibBulkIO.h
index 0d80671..0fe541f 100644
--- a/iocore/net/P_LibBulkIO.h
+++ b/iocore/net/P_LibBulkIO.h
@@ -166,8 +166,6 @@ int BulkIOSplitPkt(struct InkBulkIOState *bioCookie,
 int BulkIOAppendToReqBlock(struct InkBulkIOState *bioCookie,
                            struct InkBulkIOAggregator *bioAggregator, Ptr<IOBufferBlock> pkt);
 
-int BulkIOSend(struct InkBulkIOState *bioCookie, uint32_t blkId);
-
 void BulkIORequestComplete(struct InkBulkIOState *bioCookie, struct InkBulkIOAggregator *bioAggregator);
 
 void BulkIOFlush(struct InkBulkIOState *bioCookie, struct InkBulkIOAggregator *bioAggregator);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e669312f/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index 31a2492..239ab34 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -63,9 +63,6 @@ class UDPQueue
 public:
 
   void service(UDPNetHandler *);
-  // these are internal APIs
-  // BulkIOSend uses the BulkIO kernel module for bulk data transfer
-  void BulkIOSend();
   // In the absence of bulk-io, we are down sending packet after packet
   void SendPackets();
   void SendUDPPacket(UDPPacketInternal * p, int32_t pktLen);
@@ -378,9 +375,6 @@ struct InkSinglePipeInfo
 
 struct InkPipeInfo
 {
-  int numPipes;
-  double interfaceMbps;
-  double reliabilityMbps;
   InkSinglePipeInfo *perPipeInfo;
 };
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e669312f/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index ccf1fde..029d8cc 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -54,7 +54,6 @@ int32_t g_udp_periodicFreeCancelledPkts;
 int32_t g_udp_numSendRetries;
 
 #include "P_LibBulkIO.h"
-void *G_bulkIOState = NULL;
 
 //
 // Public functions
@@ -90,7 +89,6 @@ initialize_thread_for_udp_net(EThread * thread)
 
   thread->schedule_every(get_UDPPollCont(thread), -9);
   thread->schedule_imm(get_UDPNetHandler(thread));
-  Debug("bulk-io", "%s bulk-io for sends", G_bulkIOState ? "Using" : "Not using");
 }
 
 int
@@ -658,8 +656,8 @@ UDPQueue::service(UDPNetHandler * nh)
   double minPktSpacing;
   uint32_t pktSize;
   int64_t pktLen;
-  int i;
   bool addToGuaranteedQ;
+
   (void) nh;
   static ink_hrtime lastPrintTime = ink_get_hrtime_internal();
   static ink_hrtime lastSchedTime = ink_get_hrtime_internal();
@@ -741,46 +739,25 @@ UDPQueue::service(UDPNetHandler * nh)
     lastPrintTime = now;
   }
 
-  for (i = 0; i < G_inkPipeInfo.numPipes + 1; i++)
-    G_inkPipeInfo.perPipeInfo[i].queue->advanceNow(now);
-
-  if (G_bulkIOState) {
-    BulkIOSend();
-  } else {
-    SendPackets();
-  }
+  G_inkPipeInfo.perPipeInfo[0].queue->advanceNow(now);
+  SendPackets();
 
   timeSpent = ink_hrtime_to_msec(now - last_report);
   if (timeSpent > 10000) {
-    // if (bytesSent > 0)
-    // timespent is in milli-seconds
-    char temp[2048], *p1;
     double bw, totalBw;
 
-    temp[0] = '\0';
-    p1 = temp;
-
     if (bytesSent > 0)
       totalBw = (bytesSent * 8.0 * 1000.0) / (timeSpent * 1024.0 * 1024.0);
     else
       totalBw = 1.0;
 
-    for (i = 0; i < G_inkPipeInfo.numPipes + 1; i++) {
-      // bw is in Mbps
-      bw = (G_inkPipeInfo.perPipeInfo[i].bytesSent * 8.0 * 1000.0) / (timeSpent * 1024.0 * 1024.0);
-      snprintf(p1, sizeof(temp), "\t class[%d] = %f Mbps, alloc = %f Mbps, (conf'ed = %f, got = %f) \n",
-               i, bw, (G_inkPipeInfo.perPipeInfo[i].bwAlloc / (1024.0 * 1024.0)),
-               G_inkPipeInfo.perPipeInfo[i].wt, bw / totalBw);
-      p1 += strlen(p1);
-
-      // use a weighted estimator of current usage
-      G_inkPipeInfo.perPipeInfo[i].bwUsed = (4.0 * G_inkPipeInfo.perPipeInfo[i].bwUsed / 5.0) + (bw / 5.0);
-      G_inkPipeInfo.perPipeInfo[i].bytesSent = 0;
-      G_inkPipeInfo.perPipeInfo[i].pktsSent = 0;
-    }
-    if (temp[0])
-      Debug("udpnet-bw", "B/w: %f Mbps; breakdown: \n%s", totalBw, temp);
+    // bw is in Mbps
+    bw = (G_inkPipeInfo.perPipeInfo[0].bytesSent * 8.0 * 1000.0) / (timeSpent * 1024.0 * 1024.0);
 
+    // use a weighted estimator of current usage
+    G_inkPipeInfo.perPipeInfo[0].bwUsed = (4.0 * G_inkPipeInfo.perPipeInfo[0].bwUsed / 5.0) + (bw / 5.0);
+    G_inkPipeInfo.perPipeInfo[0].bytesSent = 0;
+    G_inkPipeInfo.perPipeInfo[0].pktsSent = 0;
 
     bytesSent = 0;
     last_report = now;
@@ -799,23 +776,14 @@ UDPQueue::SendPackets()
   // ink_hrtime send_threshold_time = now + HRTIME_MSECONDS(5);
   // send packets for SLOT_TIME per attempt
   ink_hrtime send_threshold_time = now + SLOT_TIME;
-  int32_t bytesThisSlot = INT_MAX, bytesUsed = 0, reliabilityBytes = 0;
-  int32_t bytesThisPipe, sentOne, i;
+  int32_t bytesThisSlot = INT_MAX, bytesUsed = 0;
+  int32_t bytesThisPipe, sentOne;
   int64_t pktLen;
   ink_hrtime timeDelta = 0;
 
   if (now > last_service)
     timeDelta = ink_hrtime_to_msec(now - last_service);
 
-  if (G_inkPipeInfo.numPipes > 0) {
-    bytesThisSlot = (int32_t) (((G_inkPipeInfo.reliabilityMbps * 1024.0 * 1024.0) / (8.0 * 1000.0)) * timeDelta);
-    if (bytesThisSlot == 0) {
-      // use at most 10% for reliability
-      bytesThisSlot = (int32_t) (((G_inkPipeInfo.interfaceMbps * 1024.0 * 1024.0) / (8.0 * 1000.0)) * timeDelta * 0.1);
-      reliabilityBytes = bytesThisSlot;
-    }
-  }
-
   while ((p = reliabilityPktQueue.dequeue()) != NULL) {
     pktLen = p->getPktLength();
     g_udp_bytesPending -= pktLen;
@@ -836,41 +804,35 @@ UDPQueue::SendPackets()
     p->free();
   }
 
-
-  if (G_inkPipeInfo.numPipes > 0)
-    bytesThisSlot = (int32_t) (((G_inkPipeInfo.interfaceMbps * 1024.0 * 1024.0) /
-                              (8.0 * 1000.0)) * timeDelta - reliabilityBytes);
-  else
-    bytesThisSlot = INT_MAX;
+  bytesThisSlot = INT_MAX;
 
 sendPackets:
   sentOne = false;
   send_threshold_time = now + SLOT_TIME;
-  for (i = 0; i < G_inkPipeInfo.numPipes + 1; i++) {
-    bytesThisPipe = (int32_t) (bytesThisSlot * G_inkPipeInfo.perPipeInfo[i].wt);
-    while ((bytesThisPipe > 0) && (G_inkPipeInfo.perPipeInfo[i].queue->firstPacket(send_threshold_time))) {
-      p = G_inkPipeInfo.perPipeInfo[i].queue->getFirstPacket();
-      pktLen = p->getPktLength();
-      g_udp_bytesPending -= pktLen;
-
-      p->conn->nBytesTodo -= pktLen;
-      p->conn->nBytesDone += pktLen;
-      if (p->conn->shouldDestroy())
-        goto next_pkt;
-      if (p->conn->GetSendGenerationNumber() != p->reqGenerationNum)
-        goto next_pkt;
-
-      G_inkPipeInfo.perPipeInfo[i].bytesSent += pktLen;
-      SendUDPPacket(p, pktLen);
-      bytesUsed += pktLen;
-      bytesThisPipe -= pktLen;
-    next_pkt:
-      sentOne = true;
-      p->free();
-
-      if (bytesThisPipe < 0)
-        break;
-    }
+  bytesThisPipe = (int32_t) (bytesThisSlot * G_inkPipeInfo.perPipeInfo[0].wt);
+
+  while ((bytesThisPipe > 0) && (G_inkPipeInfo.perPipeInfo[0].queue->firstPacket(send_threshold_time))) {
+    p = G_inkPipeInfo.perPipeInfo[0].queue->getFirstPacket();
+    pktLen = p->getPktLength();
+    g_udp_bytesPending -= pktLen;
+
+    p->conn->nBytesTodo -= pktLen;
+    p->conn->nBytesDone += pktLen;
+    if (p->conn->shouldDestroy())
+      goto next_pkt;
+    if (p->conn->GetSendGenerationNumber() != p->reqGenerationNum)
+      goto next_pkt;
+
+    G_inkPipeInfo.perPipeInfo[0].bytesSent += pktLen;
+    SendUDPPacket(p, pktLen);
+    bytesUsed += pktLen;
+    bytesThisPipe -= pktLen;
+  next_pkt:
+    sentOne = true;
+    p->free();
+
+    if (bytesThisPipe < 0)
+      break;
   }
 
   bytesThisSlot -= bytesUsed;
@@ -878,10 +840,8 @@ sendPackets:
   if ((bytesThisSlot > 0) && (sentOne)) {
     // redistribute the slack...
     now = ink_get_hrtime_internal();
-    for (i = 0; i < G_inkPipeInfo.numPipes + 1; i++) {
-      if (G_inkPipeInfo.perPipeInfo[i].queue->firstPacket(now) == NULL) {
-        G_inkPipeInfo.perPipeInfo[i].queue->advanceNow(now);
-      }
+    if (G_inkPipeInfo.perPipeInfo[0].queue->firstPacket(now) == NULL) {
+      G_inkPipeInfo.perPipeInfo[0].queue->advanceNow(now);
     }
     goto sendPackets;
   }
@@ -890,9 +850,8 @@ sendPackets:
       (now - lastCleanupTime > ink_hrtime_from_sec(g_udp_periodicFreeCancelledPkts))) {
     uint64_t nbytes = g_udp_bytesPending;
     ink_hrtime startTime = ink_get_hrtime_internal(), endTime;
-    for (i = 0; i < G_inkPipeInfo.numPipes + 1; i++) {
-      G_inkPipeInfo.perPipeInfo[i].queue->FreeCancelledPackets(g_udp_periodicCleanupSlots);
-    }
+
+    G_inkPipeInfo.perPipeInfo[0].queue->FreeCancelledPackets(g_udp_periodicCleanupSlots);
     endTime = ink_get_hrtime_internal();
     Debug("udp-pending-packets", "Did cleanup of %d buckets: %" PRId64 " bytes in %" PRId64 " m.sec",
           g_udp_periodicCleanupSlots, nbytes - g_udp_bytesPending, (int64_t)ink_hrtime_to_msec(endTime - startTime));
@@ -950,37 +909,6 @@ UDPQueue::SendUDPPacket(UDPPacketInternal * p, int32_t pktLen)
   }
 }
 
-#ifndef BULK_IO_SEND_IS_BROKEN
-void
-UDPQueue::BulkIOSend()
-{
-  ink_assert(!"Don't call here...");
-}
-#else
-void
-UDPQueue::BulkIOSend()
-{
-  bool sentOne = false;
-  UDPPacketInternal *p;
-  ink_hrtime now = ink_get_hrtime_internal();
-  ink_hrtime send_threshold_time = now + SLOT_TIME;
-
-  for (int i = 0; i < G_inkPipeInfo.numPipes + 1; i++) {
-    while (p = G_inkPipeInfo.perPipeInfo[i].queue->firstPacket(send_threshold_time)) {
-      p = G_inkPipeInfo.perPipeInfo[i].queue->getFirstPacket();
-      sentOne = true;
-      Debug("bulk-io-pkt", "Adding a packet...");
-      BulkIOAddPkt(G_bulkIOState, &G_bulkIOAggregator, p, p->conn->getPortNum());
-      bytesSent += p->getPktLength();
-      // Now the packet is "sent"; get rid of it
-      p->free();
-    }
-  }
-  if (sentOne) {
-    BulkIOFlush(G_bulkIOState, &G_bulkIOAggregator);
-  }
-}
-#endif
 
 void
 UDPQueue::send(UDPPacket * p)
@@ -1054,8 +982,6 @@ UDPNetHandler::mainNetEvent(int event, Event * e)
       ink_assert(uc->refcount >= 1);
       next = uc->polling_link.next;
       if (uc->shouldDestroy()) {
-        if (G_inkPipeInfo.numPipes > 0)
-          G_inkPipeInfo.perPipeInfo[uc->pipe_class].count--;
         //changed by YTS Team, yamsat
         //udp_polling->remove(uc,uc->polling_link);
         uc->Release();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e669312f/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 5337748..a22098e 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -1525,8 +1525,6 @@ main(int argc, char **argv)
   // but I don't know for sure if we still need this.
   G_inkPipeInfo.perPipeInfo = NEW(new InkSinglePipeInfo[1]);
   G_inkPipeInfo.perPipeInfo[0].wt = 1.0;
-  G_inkPipeInfo.numPipes = 0;
-  G_inkPipeInfo.interfaceMbps = 0.0;
 
   init_http_header();
 


[35/50] git commit: streamline vagrant network assignments

Posted by zw...@apache.org.
streamline vagrant network assignments

Add a IP adress assignment map to make adding VMs easy. Use the
official Ubuntu cloud images where there is one available.


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

Branch: refs/heads/3.3.x
Commit: 6eb467c5ef24f5b9deb2b7254bc8017f4a60a42c
Parents: 12c478a
Author: James Peach <jp...@apache.org>
Authored: Thu Apr 4 11:10:48 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Thu Apr 4 11:12:20 2013 -0700

----------------------------------------------------------------------
 Vagrantfile |   48 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 32 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6eb467c5/Vagrantfile
----------------------------------------------------------------------
diff --git a/Vagrantfile b/Vagrantfile
index 85998e6..f98f415 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -14,6 +14,16 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
+$network = {
+  raring64: "192.168.100.1",
+  quantal4: "192.168.100.2",
+  precise64:"192.168.100.3",
+  lucid64:  "192.168.100.4",
+  centos63: "192.168.100.5",
+  freebsd:  "192.168.100.6",
+  omnios:   "192.168.100.7",
+}
+
 Vagrant.configure("2") do |config|
 
   # Default all VMs to 1GB.
@@ -25,37 +35,43 @@ Vagrant.configure("2") do |config|
   # because it's faster and vboxfs doesn't support links.
   config.vm.synced_folder ".", "/opt/src/trafficserver.git", :nfs => true
 
+  # Ubuntu 13.04 (Raring Ringtail)
+  # Ubuntu 12.10 (Quantal Quetzal)
   # Ubuntu 12.04 LTS (Precise Pangolin)
-  config.vm.define :precise64 do | config |
-    config.vm.box = "precise64"
-    config.vm.box_url = "http://files.vagrantup.com/precise64.box"
-    config.vm.network :private_network, ip: "192.168.100.3"
-    config.vm.provision :puppet do |puppet|
-      puppet.manifests_path = "contrib/manifests"
-      puppet.manifest_file = "debian.pp"
+  ['raring', 'quantal', 'precise'].each { |release|
+    config.vm.define "#{release}64" do | config |
+      config.vm.box = "#{release}64"
+      config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/%{release}/current/#{release}-server-cloudimg-amd64-vagrant-disk1.box"
+      config.vm.network :private_network, ip: $network["#{release}64"]
+      config.vm.provision :puppet do |puppet|
+        puppet.manifests_path = "contrib/manifests"
+        puppet.manifest_file = "debian.pp"
+      end
     end
-  end
+  }
 
   # Ubuntu 10.04 LTS (Lucid Lynx)
   config.vm.define :lucid64 do | config |
     config.vm.box = "lucid64"
-    config.vm.network :hostonly, "192.168.100.2"
+    config.vm.network :private_network, ip: $network["lucid64"]
     config.vm.box_url = "http://files.vagrantup.com/lucid64.box"
   end
 
   config.vm.define :freebsd do | config |
     config.vm.box = "freebsd"
-    config.vm.share_folder "src", "/opt/src", "src", :nfs => false
+    config.vm.synced_folder ".", "/opt/src/trafficserver.git", :nfs => false
     # Force the FreeBSD VM to use a network driver that actually works.
-    config.vm.customize ["modifyvm", :id, "--nictype1", "82543GC"]
-    config.vm.customize ["modifyvm", :id, "--nictype2", "82543GC"]
-    config.vm.network :hostonly, "192.168.100.6"
+    config.vm.provider :virtualbox do |v|
+      v.customize ["modifyvm", :id, "--nictype1", "82543GC"]
+      v.customize ["modifyvm", :id, "--nictype2", "82543GC"]
+    end
+    config.vm.network :private_network, ip: $network["freebsd"]
     config.vm.box_url = "https://github.com/downloads/xironix/freebsd-vagrant/freebsd_amd64_zfs.box"
   end
 
   config.vm.define :centos63 do |config|
     config.vm.box = "centos63"
-    config.vm.network :private_network, ip: "192.168.100.8"
+    config.vm.network :private_network, ip: $network["centos63"]
     config.vm.box_url = "https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box"
     config.vm.provision :puppet do |puppet|
       puppet.manifests_path = "contrib/manifests"
@@ -67,10 +83,10 @@ Vagrant.configure("2") do |config|
   config.vm.define :omnios do | config |
     config.vm.box = "omnios"
     config.vm.guest = :solaris
-    config.vm.network :private_network, ip: "192.168.100.9"
+    config.vm.network :private_network, ip: $network["omnios"]
     config.vm.synced_folder ".", "/opt/src/trafficserver.git", :nfs => false
     config.vm.box_url = "http://omnios.omniti.com/media/omnios-latest.box"
-    config.vm.provision :shell,  :path => "contrib/manifests/omnios.sh"
+    config.vm.provision :shell, :path => "contrib/manifests/omnios.sh"
   end
 
 end


[11/50] git commit: TS-1067 Remove get_allocatedBandwidth()

Posted by zw...@apache.org.
TS-1067 Remove get_allocatedBandwidth()


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

Branch: refs/heads/3.3.x
Commit: e4865439d057beadd432248666208f71788c6513
Parents: f8a6791
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 08:58:34 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:52:33 2013 -0600

----------------------------------------------------------------------
 iocore/net/I_UDPConnection.h |    2 --
 iocore/net/P_UDPConnection.h |   10 ----------
 2 files changed, 0 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e4865439/iocore/net/I_UDPConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPConnection.h b/iocore/net/I_UDPConnection.h
index 045f376..91fe2b3 100644
--- a/iocore/net/I_UDPConnection.h
+++ b/iocore/net/I_UDPConnection.h
@@ -55,8 +55,6 @@ public:
 
   void destroy();
   int shouldDestroy();
-  /* Returns the b/w allocated to this UDP connection in Mbps */
-  double get_allocatedBandwidth();
   /**
      <p>
      <b>Callbacks:</b><br>

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e4865439/iocore/net/P_UDPConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPConnection.h b/iocore/net/P_UDPConnection.h
index 6c1c40d..aacea6d 100644
--- a/iocore/net/P_UDPConnection.h
+++ b/iocore/net/P_UDPConnection.h
@@ -97,9 +97,6 @@ UDPConnectionInternal::UDPConnectionInternal()
 TS_INLINE
 UDPConnectionInternal::~UDPConnectionInternal()
 {
-  // TODO: This is not necessary, and should be removed with the
-  // elimination of UDP bandwidth limiting (used by long since
-  // removed UDP protocols). See bug TS-1067.
   continuation = NULL;
   mutex = NULL;
 }
@@ -127,13 +124,6 @@ UDPConnection::getBinding(struct sockaddr *s)
   return p->binding_valid;
 }
 
-// return the b/w allocated to this UDPConnection in Mbps
-TS_INLINE double
-UDPConnection::get_allocatedBandwidth()
-{
-  return (((UDPConnectionInternal *) this)->flowRateBps * 8.0) / (1024.0 * 1024.0);
-}
-
 TS_INLINE void
 UDPConnection::destroy()
 {


[40/50] git commit: TS-1805: fix uninitialized result_type in NodeStatEval()

Posted by zw...@apache.org.
TS-1805: fix uninitialized result_type in NodeStatEval()

BTW, refine the output when call Fatal() in statVarSet().

Signed-off-by: Yunkai Zhang <qi...@taobao.com>
Signed-off-by: Zhao Yongming <mi...@gmail.com>


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

Branch: refs/heads/3.3.x
Commit: 2d24177575dd36a8ccbd3b84e0740acbabd3016e
Parents: e935eba
Author: Yunkai Zhang <qi...@taobao.com>
Authored: Mon Apr 8 13:23:06 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Mon Apr 8 13:40:30 2013 +0800

----------------------------------------------------------------------
 mgmt/stats/StatType.cc |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2d241775/mgmt/stats/StatType.cc
----------------------------------------------------------------------
diff --git a/mgmt/stats/StatType.cc b/mgmt/stats/StatType.cc
index efdde92..868a2f4 100644
--- a/mgmt/stats/StatType.cc
+++ b/mgmt/stats/StatType.cc
@@ -252,7 +252,7 @@ bool StatExprToken::statVarSet(RecDataT type, RecData value)
       else if (type == RECD_FLOAT || type == RECD_CONST)
         converted_value.rec_int = (RecInt)value.rec_float;
       else
-        Fatal("invalid value type:%d\n", m_token_type);
+        Fatal("%s, invalid value type:%d\n", m_token_name, type);
       break;
     case RECD_FLOAT:
       if (type == RECD_NULL)
@@ -262,10 +262,10 @@ bool StatExprToken::statVarSet(RecDataT type, RecData value)
       else if (type == RECD_FLOAT || type == RECD_CONST)
         converted_value.rec_float = value.rec_float;
       else
-        Fatal("invalid value type:%d\n", m_token_type);
+        Fatal("%s, invalid value type:%d\n", m_token_name, type);
       break;
     default:
-      Fatal("unsupported token type:%d\n", m_token_type);
+      Fatal("%s, unsupported token type:%d\n", m_token_name, m_token_type);
     }
   } else {
     converted_value = value;
@@ -673,6 +673,8 @@ RecData StatObject::NodeStatEval(RecDataT *result_type, bool cluster)
   RecData tempValue;
   RecDataClear(RECD_NULL, &tempValue);
 
+  *result_type = RECD_NULL;
+
   /* Express checkout lane -- Stat. object with on 1 source variable */
   if (m_postfix->count() == 1) {
     StatExprToken * src = m_postfix->top();


[30/50] git commit: TS-1760: Option to use Linux native AIO

Posted by zw...@apache.org.
TS-1760: Option to use Linux native AIO

to enable the Linux Native AIO, be sure to check Linux kernel AIO
supporting and use '--use_linux_native_aio' configure directive.

in the Linux Native AIO, all the IO is managed by system, so
proxy.config.cache.threads_per_disk have no meaning anymore.


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

Branch: refs/heads/3.3.x
Commit: c95298dfcc6336cc04f172713f5d41e023d19d51
Parents: 84df57e
Author: weijin <ta...@taobao.com>
Authored: Wed Apr 3 14:59:48 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Wed Apr 3 15:34:53 2013 +0800

----------------------------------------------------------------------
 configure.ac             |   19 +++++
 iocore/aio/AIO.cc        |  146 +++++++++++++++++++++++++++++++++++++++--
 iocore/aio/I_AIO.h       |  129 ++++++++++++++++++++++++++++++++++++-
 iocore/aio/P_AIO.h       |   59 +++++++++++++++--
 iocore/cache/Cache.cc    |   74 ++++++++++++++++++++-
 iocore/cache/CacheVol.cc |    2 +-
 lib/ts/ink_aiocb.h       |    4 +-
 lib/ts/ink_config.h.in   |    1 +
 proxy/InkAPI.cc          |    4 +
 9 files changed, 421 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c95298df/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 7b30f26..72e60b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -398,6 +398,25 @@ TS_ARG_ENABLE_VAR([use], [reclaimable_freelist])
 AC_SUBST(use_reclaimable_freelist)
 
 #
+# If the OS is linux, we can use '--use_linux_native_aio' option to
+# replace the aio thread mode. Effective only on the linux system.
+#
+
+if test "x${host_os_def}" = "xlinux"; then
+  AC_MSG_CHECKING([whether to use native aio or not])
+  AC_ARG_ENABLE([linux_native_aio],
+    [AS_HELP_STRING([--enable-linux-native-aio],
+      [turn on linux native aio, only effective on linux system])],
+    [],
+    [enable_linux_native_aio="yes"])
+  AC_MSG_RESULT([$enable_linux_native_aio])
+else
+  enable_linux_native_aio="no"
+fi
+TS_ARG_ENABLE_VAR([use], [linux_native_aio])
+AC_SUBST(use_linux_native_aio)
+
+
 # Configure how many stats to allocate for plugins. Default is 512.
 #
 AC_ARG_WITH([max-api-stats],

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c95298df/iocore/aio/AIO.cc
----------------------------------------------------------------------
diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc
index 3086f0c..40bf1b1 100644
--- a/iocore/aio/AIO.cc
+++ b/iocore/aio/AIO.cc
@@ -27,6 +27,10 @@
 
 #include "P_AIO.h"
 
+#if AIO_MODE == AIO_MODE_NATIVE
+#define AIO_PERIOD                                -HRTIME_MSECONDS(4)
+#else
+
 #define MAX_DISKS_POSSIBLE 100
 
 // globals
@@ -36,24 +40,24 @@ int ts_config_with_inkdiskio = 0;
 AIO_Reqs *aio_reqs[MAX_DISKS_POSSIBLE];
 /* number of unique file descriptors in the aio_reqs array */
 volatile int num_filedes = 1;
-RecRawStatBlock *aio_rsb = NULL;
+
 // acquire this mutex before inserting a new entry in the aio_reqs array.
 // Don't need to acquire this for searching the array
 static ink_mutex insert_mutex;
-Continuation *aio_err_callbck = 0;
+
 RecInt cache_config_threads_per_disk = 12;
 RecInt api_config_threads_per_disk = 12;
 int thread_is_created = 0;
+#endif // AIO_MODE == AIO_MODE_NATIVE
 
-
+RecRawStatBlock *aio_rsb = NULL;
+Continuation *aio_err_callbck = 0;
 // AIO Stats
 uint64_t aio_num_read = 0;
 uint64_t aio_bytes_read = 0;
 uint64_t aio_num_write = 0;
 uint64_t aio_bytes_written = 0;
 
-static void aio_move(AIO_Reqs *req);
-
 /*
  * Stats
  */
@@ -156,10 +160,12 @@ ink_aio_init(ModuleVersion v)
   RecRegisterRawStat(aio_rsb, RECT_PROCESS,
                      "proxy.process.cache.KB_write_per_sec",
                      RECD_FLOAT, RECP_NULL, (int) AIO_STAT_KB_WRITE_PER_SEC, aio_stats_cb);
+#if AIO_MODE != AIO_MODE_NATIVE
   memset(&aio_reqs, 0, MAX_DISKS_POSSIBLE * sizeof(AIO_Reqs *));
   ink_mutex_init(&insert_mutex, NULL);
 
   REC_ReadConfigInteger(cache_config_threads_per_disk, "proxy.config.cache.threads_per_disk");
+#endif
 }
 
 int
@@ -172,6 +178,7 @@ ink_aio_start()
   return 0;
 }
 
+#if  AIO_MODE != AIO_MODE_NATIVE
 
 static void *aio_thread_main(void *arg);
 
@@ -534,3 +541,132 @@ aio_thread_main(void *arg)
   }
   return 0;
 }
+#else
+int
+DiskHandler::startAIOEvent(int event, Event *e) {
+  SET_HANDLER(&DiskHandler::mainAIOEvent);
+  e->schedule_every(AIO_PERIOD);
+  trigger_event = e;
+  return EVENT_CONT;
+}
+
+int
+DiskHandler::mainAIOEvent(int event, Event *e) {
+  AIOCallback *op = NULL;
+Lagain:
+  int ret = io_getevents(ctx, 0, MAX_AIO_EVENTS, events, NULL);
+  //printf("%d\n", ret);
+  for (int i = 0; i < ret; i++) {
+    op = (AIOCallback *) events[i].data;
+    op->aio_result = events[i].res;
+    ink_assert(op->action.continuation);
+    complete_list.enqueue(op);
+    //op->handleEvent(event, e);
+  }
+  if (ret == MAX_AIO_EVENTS)
+    goto Lagain;
+  if (ret < 0)
+    perror("io_getevents");
+
+  ink_aiocb_t *cbs[MAX_AIO_EVENTS];
+  int num = 0;
+  for (; num < MAX_AIO_EVENTS && ((op = ready_list.dequeue()) != NULL); ++num) {
+    cbs[num] = &op->aiocb;
+    ink_debug_assert(op->action.continuation);
+  }
+  if (num > 0) {
+    int ret;
+    do {
+      ret = io_submit(ctx, num, cbs);
+    } while (ret < 0 && errno == EAGAIN);
+
+    if (ret != num) {
+      if (ret < 0)
+        perror("io_submit error");
+      else {
+        fprintf(stderr, "could not sumbit IOs");
+        ink_debug_assert(0);
+      }
+    }
+  }
+
+  while ((op = complete_list.dequeue()) != NULL) {
+    op->handleEvent(event, e);
+  }
+  return EVENT_CONT;
+}
+
+int
+ink_aio_read(AIOCallback *op, int fromAPI) {
+  op->aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY;
+  op->aiocb.aio_lio_opcode = IOCB_CMD_PREAD;
+  op->aiocb.aio_data = op;
+  this_ethread()->diskHandler->ready_list.enqueue(op);
+
+  return 1;
+}
+
+int
+ink_aio_write(AIOCallback *op, int fromAPI) {
+  op->aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY;
+  op->aiocb.aio_lio_opcode = IOCB_CMD_PWRITE;
+  op->aiocb.aio_data = op;
+  this_ethread()->diskHandler->ready_list.enqueue(op);
+
+  return 1;
+}
+
+int
+ink_aio_readv(AIOCallback *op, int fromAPI) {
+  DiskHandler *dh = this_ethread()->diskHandler;
+  AIOCallback *io = op;
+  int sz = 0;
+
+  while (io) {
+    io->aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY;
+    io->aiocb.aio_lio_opcode = IOCB_CMD_PREAD;
+    io->aiocb.aio_data = io;
+    dh->ready_list.enqueue(io);
+    ++sz;
+    io = io->then;
+  }
+
+  if (sz > 1) {
+    ink_debug_assert(op->action.continuation);
+    AIOVec *vec = new AIOVec(sz, op->action.continuation);
+    vec->action = op->action.continuation;
+    while (--sz >= 0) {
+      op->action = vec;
+      op = op->then;
+    }
+  }
+  return 1;
+}
+
+int
+ink_aio_writev(AIOCallback *op, int fromAPI) {
+  DiskHandler *dh = this_ethread()->diskHandler;
+  AIOCallback *io = op;
+  int sz = 0;
+
+  while (io) {
+    io->aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY;
+    io->aiocb.aio_lio_opcode = IOCB_CMD_PWRITE;
+    io->aiocb.aio_data = io;
+    dh->ready_list.enqueue(io);
+    ++sz;
+    io = io->then;
+  }
+
+  if (sz > 1) {
+    ink_debug_assert(op->action.continuation);
+    AIOVec *vec = new AIOVec(sz, op->action.continuation);
+    vec->action = op->action.continuation;
+    while (--sz >= 0) {
+      op->action = vec;
+      op = op->then;
+    }
+  }
+  return 1;
+}
+#endif // AIO_MODE != AIO_MODE_NATIVE

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c95298df/iocore/aio/I_AIO.h
----------------------------------------------------------------------
diff --git a/iocore/aio/I_AIO.h b/iocore/aio/I_AIO.h
index 8d4cd2b..ccdc078 100644
--- a/iocore/aio/I_AIO.h
+++ b/iocore/aio/I_AIO.h
@@ -46,8 +46,114 @@
 #define AIO_MODE_AIO             0
 #define AIO_MODE_SYNC            1
 #define AIO_MODE_THREAD          2
+#define AIO_MODE_NATIVE          3
+#if use_linux_native_aio
+#define AIO_MODE                 AIO_MODE_NATIVE
+#else
 #define AIO_MODE                 AIO_MODE_THREAD
+#endif
+
+#if AIO_MODE == AIO_MODE_NATIVE
+
+#include <sys/syscall.h>  /* for __NR_* definitions */
+#include <linux/aio_abi.h>  /* for AIO types and constants */
+#define MAX_AIO_EVENTS 1024
+
+#if defined(__LITTLE_ENDIAN)
+#if (SIZEOF_VOID_POINTER == 4)
+#define PADDEDPtr(x, y) x; unsigned y
+#define PADDEDul(x, y) unsigned long x; unsigned y
+#elif (SIZEOF_VOID_POINTER == 8)
+#define PADDEDPtr(x, y) x
+#define PADDEDul(x, y) unsigned long x
+#endif
+#elif defined(__BIG_ENDIAN)
+#if (SIZEOF_VOID_POINTER == 4)
+#define PADDEDPtr(x, y) unsigned y; x
+#define PADDEDul(x, y) unsigned y; unsigned long y
+#elif (SIZEOF_VOID_POINTER == 8)
+#define PADDEDPtr(x, y) x
+#define PADDEDul(x, y) unsigned long x
+#endif
+#else
+#error edit for your odd byteorder.
+#endif
+
+typedef struct ink_iocb {
+  /* these are internal to the kernel/libc. */
+  PADDEDPtr(void *aio_data, _pad1); /* data to be returned in event's data */
+  unsigned PADDED(aio_key, aio_reserved1);
+        /* the kernel sets aio_key to the req # */
+
+  /* common fields */
+  short aio_lio_opcode; /* see IOCB_CMD_ above */
+  short aio_reqprio;
+  int aio_fildes;
+
+  PADDEDPtr(void *aio_buf, _pad2);
+  PADDEDul(aio_nbytes, _pad3);
+  int64_t aio_offset;
+
+  /* extra parameters */
+  uint64_t aio_reserved2;  /* TODO: use this for a (struct sigevent *) */
+
+  /* flags for the "struct iocb" */
+  int aio_flags;
+
+  /*
+   * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an
+   * eventfd to signal AIO readiness to
+   */
+  int aio_resfd;
+
+} ink_aiocb_t;
+
+typedef struct ink_io_event {
+  PADDEDPtr(void *data, _pad1);   /* the data field from the iocb */
+  PADDEDPtr(ink_aiocb_t *obj, _pad2);    /* what iocb this event came from */
+  PADDEDul(res, _pad3);    /* result code for this event */
+  PADDEDul(res2, _pad4);   /* secondary result */
+} ink_io_event_t;
+
+TS_INLINE int io_setup(unsigned nr, aio_context_t *ctxp)
+{
+  return syscall(__NR_io_setup, nr, ctxp);
+}
+
+TS_INLINE int io_destroy(aio_context_t ctx)
+{
+  return syscall(__NR_io_destroy, ctx);
+}
+
+TS_INLINE int io_submit(aio_context_t ctx, long nr,  ink_aiocb_t **iocbpp)
+{
+  return syscall(__NR_io_submit, ctx, nr, iocbpp);
+}
+
+TS_INLINE int io_getevents(aio_context_t ctx, long min_nr, long max_nr,
+    ink_io_event_t *events, struct timespec *timeout)
+{
+  return syscall(__NR_io_getevents, ctx, min_nr, max_nr, events, timeout);
+}
+
+struct AIOVec: public Continuation
+{
+  Action action;
+  int size;
+  int completed;
+
+  AIOVec(int sz, Continuation *c): Continuation(new_ProxyMutex()), size(sz), completed(0)
+  {
+    action = c;
+    SET_HANDLER(&AIOVec::mainEvent);
+  }
 
+  int mainEvent(int event, Event *e);
+};
+#else
+typedef ink_aiocb ink_aiocb_t;
+bool ink_aio_thread_num_set(int thread_num);
+#endif
 // AIOCallback::thread special values
 #define AIO_CALLBACK_THREAD_ANY ((EThread*)0) // any regular event thread
 #define AIO_CALLBACK_THREAD_AIO ((EThread*)-1)
@@ -71,12 +177,33 @@ struct AIOCallback: public Continuation
   }
 };
 
+#if AIO_MODE == AIO_MODE_NATIVE
+struct DiskHandler: public Continuation
+{
+  Event *trigger_event;
+  aio_context_t ctx;
+  ink_io_event_t events[MAX_AIO_EVENTS];
+  Que(AIOCallback, link) ready_list;
+  Que(AIOCallback, link) complete_list;
+  int startAIOEvent(int event, Event *e);
+  int mainAIOEvent(int event, Event *e);
+  DiskHandler() {
+    SET_HANDLER(&DiskHandler::startAIOEvent);
+    memset(&ctx, 0, sizeof(aio_context_t));
+    int ret = io_setup(MAX_AIO_EVENTS, &ctx);
+    if (ret < 0) {
+      perror("io_setup error");
+    }
+  }
+};
+#endif
 void ink_aio_init(ModuleVersion version);
 int ink_aio_start();
 void ink_aio_set_callback(Continuation * error_callback);
 
 int ink_aio_read(AIOCallback *op, int fromAPI = 0);   // fromAPI is a boolean to indicate if this is from a API call such as upload proxy feature
 int ink_aio_write(AIOCallback *op, int fromAPI = 0);
-bool ink_aio_thread_num_set(int thread_num);
+int ink_aio_readv(AIOCallback *op, int fromAPI = 0);   // fromAPI is a boolean to indicate if this is from a API call such as upload proxy feature
+int ink_aio_writev(AIOCallback *op, int fromAPI = 0);
 AIOCallback *new_AIOCallback(void);
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c95298df/iocore/aio/P_AIO.h
----------------------------------------------------------------------
diff --git a/iocore/aio/P_AIO.h b/iocore/aio/P_AIO.h
index 2d686e3..9e3321c 100644
--- a/iocore/aio/P_AIO.h
+++ b/iocore/aio/P_AIO.h
@@ -41,6 +41,58 @@
 #define AIO_MODULE_VERSION        makeModuleVersion(AIO_MODULE_MAJOR_VERSION,\
 						    AIO_MODULE_MINOR_VERSION,\
 						    PRIVATE_MODULE_HEADER)
+
+TS_INLINE int
+AIOCallback::ok()
+{
+  return (off_t) aiocb.aio_nbytes == (off_t) aio_result;
+}
+
+#if AIO_MODE == AIO_MODE_NATIVE
+
+extern Continuation *aio_err_callbck;
+
+struct AIOCallbackInternal: public AIOCallback
+{
+  int io_complete(int event, void *data);
+  AIOCallbackInternal()
+  {
+    memset ((char *) &(this->aiocb), 0, sizeof(this->aiocb));
+    SET_HANDLER(&AIOCallbackInternal::io_complete);
+  }
+};
+
+TS_INLINE int
+AIOCallbackInternal::io_complete(int event, void *data)
+{
+  (void) event;
+  (void) data;
+
+  if (!ok() && aio_err_callbck)
+    eventProcessor.schedule_imm(aio_err_callbck, ET_CALL, AIO_EVENT_DONE);
+  mutex = action.mutex;
+  MUTEX_LOCK(lock, mutex, this_ethread());
+  if (!action.cancelled)
+    action.continuation->handleEvent(AIO_EVENT_DONE, this);
+  return EVENT_DONE;
+}
+
+TS_INLINE int
+AIOVec::mainEvent(int event, Event *e) {
+  ++completed;
+  if (completed < size)
+    return EVENT_CONT;
+  else if (completed == size) {
+    MUTEX_LOCK(lock, action.mutex, this_ethread());
+    if (!action.cancelled)
+      action.continuation->handleEvent(AIO_EVENT_DONE, this);
+    delete this;
+    return EVENT_DONE;
+  }
+  ink_assert(!"AIOVec mainEvent err");
+  return EVENT_ERROR;
+}
+#else
 struct AIO_Reqs;
 
 struct AIOCallbackInternal: public AIOCallback
@@ -61,12 +113,6 @@ struct AIOCallbackInternal: public AIOCallback
 };
 
 TS_INLINE int
-AIOCallback::ok()
-{
-  return (off_t) aiocb.aio_nbytes == (off_t) aio_result;
-}
-
-TS_INLINE int
 AIOCallbackInternal::io_complete(int event, void *data)
 {
   (void) event;
@@ -92,6 +138,7 @@ struct AIO_Reqs
   volatile int requests_queued;
 };
 
+#endif // AIO_MODE == AIO_MODE_NATIVE
 #ifdef AIO_STATS
 class AIOTestData:public Continuation
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c95298df/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 1232a11..d5ba29f 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -146,6 +146,51 @@ struct VolInitInfo
   }
 };
 
+#if AIO_MODE == AIO_MODE_NATIVE
+struct VolInit : public Continuation
+{
+  Vol *vol;
+  char *path;
+  off_t blocks;
+  int64_t offset;
+  bool vol_clear;
+
+  int mainEvent(int event, Event *e) {
+    vol->init(path, blocks, offset, vol_clear);
+    mutex.clear();
+    delete this;
+    return EVENT_DONE;
+  }
+
+  VolInit(Vol *v, char *p, off_t b, int64_t o, bool c) : Continuation(v->mutex),
+    vol(v), path(p), blocks(b), offset(o), vol_clear(c) {
+    SET_HANDLER(&VolInit::mainEvent);
+  }
+};
+
+struct DiskInit : public Continuation
+{
+  CacheDisk *disk;
+  char *s;
+  off_t blocks;
+  off_t askip;
+  int ahw_sector_size;
+  int fildes;
+  bool clear;
+
+  int mainEvent(int event, Event *e) {
+    disk->open(s, blocks, askip, ahw_sector_size, fildes, clear);
+    mutex.clear();
+    delete this;
+    return EVENT_DONE;
+  }
+
+  DiskInit(CacheDisk *d, char *str, off_t b, off_t skip, int sector, int f, bool c) : Continuation(d->mutex),
+      disk(d), s(str), blocks(b), askip(skip), ahw_sector_size(sector), fildes(f), clear(c) {
+    SET_HANDLER(&DiskInit::mainEvent);
+  }
+};
+#endif
 void cplist_init();
 static void cplist_update();
 int cplist_reconfigure();
@@ -530,6 +575,16 @@ CacheProcessor::start_internal(int flags)
   verify_cache_api();
 #endif
 
+#if AIO_MODE == AIO_MODE_NATIVE
+  int etype = ET_NET;
+  int n_netthreads = eventProcessor.n_threads_for_type[etype];
+  EThread **netthreads = eventProcessor.eventthread[etype];
+  for (int i = 0; i < n_netthreads; ++i) {
+    netthreads[i]->diskHandler = new DiskHandler();
+    netthreads[i]->schedule_imm(netthreads[i]->diskHandler);
+  }
+#endif
+
   start_internal_flags = flags;
   clear = !!(flags & PROCESSOR_RECONFIGURE) || auto_clear_flag;
   fix = !!(flags & PROCESSOR_FIX);
@@ -593,7 +648,11 @@ CacheProcessor::start_internal(int flags)
         }
         off_t skip = ROUND_TO_STORE_BLOCK((sd->offset < START_POS ? START_POS + sd->alignment : sd->offset));
         blocks = blocks - ROUND_TO_STORE_BLOCK(sd->offset + skip);
+#if AIO_MODE == AIO_MODE_NATIVE
+        eventProcessor.schedule_imm(NEW(new DiskInit(gdisks[gndisks], path, blocks, skip, sector_size, fd, clear)));
+#else
         gdisks[gndisks]->open(path, blocks, skip, sector_size, fd, clear);
+#endif
         gndisks++;
       }
     } else {
@@ -1109,8 +1168,11 @@ Vol::init(char *s, off_t blocks, off_t dir_skip, bool clear)
     aio->thread = AIO_CALLBACK_THREAD_ANY;
     aio->then = (i < 3) ? &(init_info->vol_aio[i + 1]) : 0;
   }
-
+#if AIO_MODE == AIO_MODE_NATIVE
+  ink_assert(ink_aio_readv(init_info->vol_aio));
+#else
   ink_assert(ink_aio_read(init_info->vol_aio));
+#endif
   return 0;
 }
 
@@ -1440,7 +1502,11 @@ Ldone:{
     init_info->vol_aio[2].aiocb.aio_offset = ss + dirlen - footerlen;
 
     SET_HANDLER(&Vol::handle_recover_write_dir);
+#if AIO_MODE == AIO_MODE_NATIVE
+    ink_assert(ink_aio_writev(init_info->vol_aio));
+#else
     ink_assert(ink_aio_write(init_info->vol_aio));
+#endif
     return EVENT_CONT;
   }
 
@@ -1812,7 +1878,11 @@ Cache::open(bool clear, bool fix) {
             blocks = q->b->len;
 
             bool vol_clear = clear || d->cleared || q->new_block;
+#if AIO_MODE == AIO_MODE_NATIVE
+            eventProcessor.schedule_imm(NEW(new VolInit(cp->vols[vol_no], d->path, blocks, q->b->offset, vol_clear)));
+#else
             cp->vols[vol_no]->init(d->path, blocks, q->b->offset, vol_clear);
+#endif
             vol_no++;
             cache_size += blocks;
           }
@@ -1926,7 +1996,7 @@ CacheVC::handleReadDone(int event, Event *e) {
         if (checksum != doc->checksum) {
           Note("cache: checksum error for [%" PRIu64 " %" PRIu64 "] len %d, hlen %d, disk %s, offset %" PRIu64 " size %zu",
                doc->first_key.b[0], doc->first_key.b[1],
-               doc->len, doc->hlen, vol->path, io.aiocb.aio_offset, io.aiocb.aio_nbytes);
+               doc->len, doc->hlen, vol->path, io.aiocb.aio_offset, (size_t)io.aiocb.aio_nbytes);
           doc->magic = DOC_CORRUPT;
           okay = 0;
         }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c95298df/iocore/cache/CacheVol.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheVol.cc b/iocore/cache/CacheVol.cc
index bf4fad9..ccd2009 100644
--- a/iocore/cache/CacheVol.cc
+++ b/iocore/cache/CacheVol.cc
@@ -365,7 +365,7 @@ Lread:
   offset = 0;
   ink_assert(ink_aio_read(&io) >= 0);
   Debug("cache_scan_truss", "read %p:scanObject %" PRId64 " %zu", this,
-        (int64_t)io.aiocb.aio_offset, io.aiocb.aio_nbytes);
+        (int64_t)io.aiocb.aio_offset, (size_t)io.aiocb.aio_nbytes);
   return EVENT_CONT;
 
 Ldone:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c95298df/lib/ts/ink_aiocb.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_aiocb.h b/lib/ts/ink_aiocb.h
index 1cf9d38..543243b 100644
--- a/lib/ts/ink_aiocb.h
+++ b/lib/ts/ink_aiocb.h
@@ -39,7 +39,7 @@
 #define	LIO_READ	0x1
 #define	LIO_WRITE	0x2
 
-typedef struct ink_aiocb
+struct ink_aiocb
 {
   int aio_fildes;
 #if	defined(__STDC__)
@@ -58,6 +58,6 @@ typedef struct ink_aiocb
   //    aio_result_t    aio_resultp;    /* results */
   int aio_state;                /* state flag for List I/O */
   int aio__pad[1];              /* extension padding */
-} ink_aiocb_t;
+};
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c95298df/lib/ts/ink_config.h.in
----------------------------------------------------------------------
diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in
index 6b0525c..93e393c 100644
--- a/lib/ts/ink_config.h.in
+++ b/lib/ts/ink_config.h.in
@@ -122,6 +122,7 @@
 #define TS_USE_RECLAIMABLE_FREELIST    @use_reclaimable_freelist@
 #define TS_USE_TLS_NPN                 @use_tls_npn@
 #define TS_USE_TLS_SNI                 @use_tls_sni@
+#define TS_USE_LINUX_NATIVE_AIO        @use_linux_native_aio@
 
 /* OS API definitions */
 #define GETHOSTBYNAME_R_HOSTENT_DATA   @gethostbyname_r_hostent_data@

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c95298df/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 661a2d0..fd8258e 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7324,10 +7324,14 @@ TSAIOWrite(int fd, off_t offset, char* buf, const size_t bufSize, TSCont contp)
 TSReturnCode
 TSAIOThreadNumSet(int thread_num)
 {
+#if AIO_MODE == AIO_MODE_NATIVE
+  return TS_SUCCESS;
+#else
   if (ink_aio_thread_num_set(thread_num))
     return TS_SUCCESS;
 
   return TS_ERROR;
+#endif
 }
 
 void


[47/50] git commit: Merge https://git-wip-us.apache.org/repos/asf/trafficserver

Posted by zw...@apache.org.
Merge https://git-wip-us.apache.org/repos/asf/trafficserver


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

Branch: refs/heads/3.3.x
Commit: 41f1c2e143501f060fb8b9b43d40d6ca194c7147
Parents: 5654cf4 e2aff41
Author: niq <ni...@apache.org>
Authored: Mon Apr 15 16:32:25 2013 +0100
Committer: niq <ni...@apache.org>
Committed: Mon Apr 15 16:32:25 2013 +0100

----------------------------------------------------------------------
 CHANGES                                            |   11 +
 Vagrantfile                                        |    2 +-
 contrib/manifests/debian.pp                        |    2 +-
 .../perl/AdminClient/lib/Apache/TS/AdminClient.pm  |    1 -
 example/app-template/app-template.cc               |    6 +-
 iocore/cache/Cache.cc                              |   12 +
 iocore/cache/CacheWrite.cc                         |   20 ++-
 iocore/cache/P_CacheInternal.h                     |    3 +
 iocore/cache/P_CacheVol.h                          |    2 +-
 mgmt/Main.cc                                       |    3 -
 mgmt/RecordsConfig.cc                              |    6 +-
 mgmt/api/CfgContextUtils.cc                        |   70 ++----
 mgmt/api/CfgContextUtils.h                         |    2 +-
 mgmt/api/CoreAPI.cc                                |    7 +-
 mgmt/api/include/mgmtapi.h                         |    2 +-
 mgmt/stats/StatProcessor.cc                        |    3 +-
 mgmt/stats/StatType.cc                             |   84 +++++--
 mgmt/stats/StatType.h                              |    6 +-
 proxy/Main.cc                                      |    6 +-
 proxy/Makefile.am                                  |    3 -
 proxy/Plugin.cc                                    |   64 +----
 proxy/Plugin.h                                     |    2 +-
 proxy/PluginDB.cc                                  |  205 ---------------
 proxy/PluginDB.h                                   |   65 -----
 proxy/config/Makefile.am                           |    1 -
 proxy/config/mgr.cnf.default                       |    9 -
 proxy/config/records.config.default.in             |    3 +
 27 files changed, 154 insertions(+), 446 deletions(-)
----------------------------------------------------------------------



[13/50] git commit: TS-1067 Remove the bandwidth management APIs, it is never used

Posted by zw...@apache.org.
TS-1067 Remove the bandwidth management APIs, it is never used


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

Branch: refs/heads/3.3.x
Commit: 9bb4afb1c54fe3b79b921f36700279a5ae2eb278
Parents: 435e14e
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 08:29:59 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:52:33 2013 -0600

----------------------------------------------------------------------
 iocore/net/I_UDPNet.h        |    9 ---
 iocore/net/P_UDPConnection.h |    1 -
 iocore/net/P_UDPNet.h        |    3 -
 iocore/net/UnixUDPNet.cc     |  104 +------------------------------------
 proxy/UglyLogStubs.cc        |    3 -
 5 files changed, 1 insertions(+), 119 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9bb4afb1/iocore/net/I_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPNet.h b/iocore/net/I_UDPNet.h
index 5e558ec..d9dc38b 100644
--- a/iocore/net/I_UDPNet.h
+++ b/iocore/net/I_UDPNet.h
@@ -120,15 +120,6 @@ public:
   Action *recvfrom_re(Continuation * c, void *token, int fd,
                       sockaddr *fromaddr, socklen_t *fromaddrlen,
                       IOBufferBlock * buf, int len, bool useReadCont = true, int timeout = 0);
-  // Continuation is really a UDPConnection; due to the include mess, we stick in the
-  // base-class of UDPConnection.
-  bool AllocBandwidth(Continuation * udpConn, double desiredMbps);
-  bool ChangeBandwidth(Continuation * udpConn, double desiredMbps);
-  void FreeBandwidth(Continuation * udpConn);
-  double GetAvailableBandwidth();
-
-  virtual void UDPNetProcessor_is_abstract() = 0;
-
 };
 
 inkcoreapi extern UDPNetProcessor & udpNet;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9bb4afb1/iocore/net/P_UDPConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPConnection.h b/iocore/net/P_UDPConnection.h
index e1b5186..6c1c40d 100644
--- a/iocore/net/P_UDPConnection.h
+++ b/iocore/net/P_UDPConnection.h
@@ -100,7 +100,6 @@ UDPConnectionInternal::~UDPConnectionInternal()
   // TODO: This is not necessary, and should be removed with the
   // elimination of UDP bandwidth limiting (used by long since
   // removed UDP protocols). See bug TS-1067.
-  // udpNet.FreeBandwidth(this);
   continuation = NULL;
   mutex = NULL;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9bb4afb1/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index 403152d..8a3cfb8 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -52,9 +52,6 @@ struct UDPNetProcessorInternal : public UDPNetProcessor
 
   off_t pollCont_offset;
   off_t udpNetHandler_offset;
-
-public:
-  virtual void UDPNetProcessor_is_abstract() {  }
 };
 
 extern UDPNetProcessorInternal udpNetInternal;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9bb4afb1/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index c939f0f..73dc0f6 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -682,112 +682,10 @@ Lerror:
   return ACTION_IO_ERROR;
 }
 
-bool
-UDPNetProcessor::AllocBandwidth(Continuation * udpConn, double desiredMbps)
-{
-  UDPConnectionInternal *udpIntConn = (UDPConnectionInternal *) udpConn;
-  int64_t desiredbps = (int64_t) (desiredMbps * 1024.0 * 1024.0);
-
-  if (G_inkPipeInfo.numPipes == 0) {
-    udpIntConn->flowRateBps = (desiredMbps * 1024.0 * 1024.0) / 8.0;
-    return true;
-  }
-
-  if ((udpIntConn->pipe_class == 0) ||
-      (G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc + desiredbps >
-       G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwLimit)) {
-    Debug("udpnet-admit", "Denying flow with %lf Mbps", desiredMbps);
-    return false;
-  }
-  udpIntConn->flowRateBps = (desiredMbps * 1024.0 * 1024.0) / 8.0;
-  udpIntConn->allocedbps = desiredbps;
-  ink_atomic_increment(&G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, desiredbps);
-  Debug("udpnet-admit", "Admitting flow with %lf Mbps (a=%" PRId64 ", lim=%" PRId64 ")",
-        desiredMbps,
-        G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc,
-        G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwLimit);
-  return true;
-}
-
-bool
-UDPNetProcessor::ChangeBandwidth(Continuation * udpConn, double desiredMbps)
-{
-  UDPConnectionInternal *udpIntConn = (UDPConnectionInternal *) udpConn;
-  int64_t desiredbps = (int64_t) (desiredMbps * 1024.0 * 1024.0);
-  int64_t oldbps = (int64_t) (udpIntConn->flowRateBps * 8.0);
-
-  if (G_inkPipeInfo.numPipes == 0) {
-    udpIntConn->flowRateBps = (desiredMbps * 1024.0 * 1024.0) / 8.0;
-    return true;
-  }
-  // arithmetic here is in bits-per-sec.
-  if ((udpIntConn->pipe_class == 0) ||
-      (G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc +
-       desiredbps - oldbps) > G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwLimit) {
-    Debug("udpnet-admit", "Unable to change b/w for flow to %lf Mbps", desiredMbps);
-    return false;
-  }
-  udpIntConn->flowRateBps = (desiredMbps * 1024.0 * 1024.0) / 8.0;
-  udpIntConn->allocedbps = desiredbps;
-  ink_atomic_increment(&G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, desiredbps - oldbps);
-  Debug("udpnet-admit", "Changing flow's b/w from %lf Mbps to %lf Mbps (a=%" PRId64 ", lim=%" PRId64 ")",
-        (double) oldbps / (1024.0 * 1024.0),
-        desiredMbps,
-        G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc,
-        G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwLimit);
-  return true;
-}
-
-void
-UDPNetProcessor::FreeBandwidth(Continuation * udpConn)
-{
-  UDPConnectionInternal *udpIntConn = (UDPConnectionInternal *) udpConn;
-  int64_t bps;
-
-  if (G_inkPipeInfo.numPipes == 0)
-    return;
-
-  Debug("udpnet-free", "Trying to releasing %lf (%" PRId64 ") Kbps", udpIntConn->flowRateBps, udpIntConn->allocedbps);
-
-  bps = udpIntConn->allocedbps;
-  if (bps <= 0)
-    return;
-
-  ink_atomic_increment(&G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, -bps);
-
-  Debug("udpnet-free", "Releasing %lf Kbps", bps / 1024.0);
-
-  if (G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc < 0)
-    G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc = 0;
-
-  udpIntConn->flowRateBps = 0.0;
-  udpIntConn->allocedbps = 0;
-}
-
-double
-UDPNetProcessor::GetAvailableBandwidth()
-{
-  int i;
-  double usedBw = 0.0;
-
-  if (G_inkPipeInfo.numPipes == 0)
-    // return 100Mbps if there are no pipes
-    return 100.0;
-
-  for (i = 0; i < G_inkPipeInfo.numPipes + 1; i++) {
-    usedBw += G_inkPipeInfo.perPipeInfo[i].bwUsed;
-  }
-  return G_inkPipeInfo.interfaceMbps - usedBw;
-}
 
 // send out all packets that need to be sent out as of time=now
 UDPQueue::UDPQueue()
-: last_report(0)
-, last_service(0)
-, last_byteperiod(0)
-, bytesSent(0)
-, packets(0)
-, added(0)
+  : last_report(0), last_service(0), last_byteperiod(0), bytesSent(0), packets(0), added(0)
 {
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9bb4afb1/proxy/UglyLogStubs.cc
----------------------------------------------------------------------
diff --git a/proxy/UglyLogStubs.cc b/proxy/UglyLogStubs.cc
index b68bf97..0456e2b 100644
--- a/proxy/UglyLogStubs.cc
+++ b/proxy/UglyLogStubs.cc
@@ -44,9 +44,6 @@ class FakeUDPNetProcessor : public UDPNetProcessor {
     ink_release_assert(false);
     return 0;
   };
-  virtual void UDPNetProcessor_is_abstract() {
-    ink_release_assert(false);
-  };
 } fakeUDPNet;
 
 UDPNetProcessor& udpNet = fakeUDPNet;


[49/50] git commit: Updated STATUS with v3.3.2 release.

Posted by zw...@apache.org.
Updated STATUS with v3.3.2 release.


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

Branch: refs/heads/3.3.x
Commit: e66b1b65777e57616a3e7baf15670273611682cf
Parents: d6ab2dc
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Apr 15 14:47:19 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Apr 15 14:47:19 2013 -0600

----------------------------------------------------------------------
 STATUS |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e66b1b65/STATUS
----------------------------------------------------------------------
diff --git a/STATUS b/STATUS
index 8affb32..ce71e87 100644
--- a/STATUS
+++ b/STATUS
@@ -10,6 +10,7 @@ Release history:
     [NOTE that x.{odd}.z versions are strictly Alpha/Beta releases,
           while x.{even}.z versions are Stable/GA releases.]
 
+    3.3.2           : Released on April 18th, 2013
     3.3.1           : Released on March 12th, 2013
     3.3.0           : Released on September 7th, 2012
 


[18/50] git commit: TS-1067 Replace G_inkPipeInfo with a member variable in UDPQueue

Posted by zw...@apache.org.
TS-1067 Replace G_inkPipeInfo with a member variable in UDPQueue


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

Branch: refs/heads/3.3.x
Commit: a544466d3db83d221df45442a297e46be8b14fd1
Parents: 20dacb0
Author: Leif Hedstrom <zw...@apache.org>
Authored: Wed Mar 27 10:13:09 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:53:42 2013 -0600

----------------------------------------------------------------------
 iocore/net/I_UDPNet.h    |   10 +----
 iocore/net/P_UDPNet.h    |   74 ++++++++++++++++++++--------------------
 iocore/net/UnixUDPNet.cc |   16 ++++-----
 3 files changed, 46 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a544466d/iocore/net/I_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPNet.h b/iocore/net/I_UDPNet.h
index 847e2c1..159e93b 100644
--- a/iocore/net/I_UDPNet.h
+++ b/iocore/net/I_UDPNet.h
@@ -49,14 +49,8 @@ public:
 
   //this function was interanal intially.. this is required for public and
   //interface probably should change.
-  bool CreateUDPSocket(
-    int *resfd,
-    sockaddr const* remote_addr,
-    sockaddr* local_addr,
-    int* local_addr_len,
-    Action ** status,
-    int send_bufsize = 0, int recv_bufsize = 0
-  );
+  bool CreateUDPSocket(int *resfd, sockaddr const* remote_addr, sockaddr* local_addr, int* local_addr_len,
+                       Action ** status, int send_bufsize = 0, int recv_bufsize = 0);
 
   /**
      create UDPConnection

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a544466d/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index 9cba1b3..e695383 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -56,29 +56,7 @@ struct UDPNetProcessorInternal : public UDPNetProcessor
 
 extern UDPNetProcessorInternal udpNetInternal;
 
-class PacketQueue;
 
-class UDPQueue
-{
-public:
-
-  void service(UDPNetHandler *);
-
-  void SendPackets();
-  void SendUDPPacket(UDPPacketInternal * p, int32_t pktLen);
-
-  // Interface exported to the outside world
-  void send(UDPPacket * p);
-
-  InkAtomicList atomicQueue;
-  ink_hrtime last_report;
-  ink_hrtime last_service;
-  int packets;
-  int added;
-
-  UDPQueue();
-  ~UDPQueue();
-};
 
 // 20 ms slots; 2048 slots  => 40 sec. into the future
 #define SLOT_TIME_MSEC 20
@@ -87,16 +65,16 @@ public:
 
 class PacketQueue
 {
-public:
-  PacketQueue()
-    : nPackets(0), now_slot(0)
-  {
-    lastPullLongTermQ = 0;
-    init();
-  }
+ public:
+ PacketQueue()
+   : nPackets(0), now_slot(0)
+    {
+      lastPullLongTermQ = 0;
+      init();
+    }
 
   virtual ~ PacketQueue()
-  { }
+    { }
 
   int nPackets;
   ink_hrtime lastPullLongTermQ;
@@ -250,7 +228,7 @@ public:
     now_slot = s;
   }
 
-private:
+ private:
   void remove(UDPPacketInternal * e)
   {
     nPackets--;
@@ -259,7 +237,7 @@ private:
     bucket[e->in_heap].remove(e);
   }
 
-public:
+ public:
   UDPPacketInternal *dequeue_ready(ink_hrtime t)
   {
     (void) t;
@@ -289,11 +267,37 @@ public:
     return HRTIME_FOREVER;
   }
 
-private:
+ private:
   void kill_cancelled_events()
   { }
 };
 
+
+class UDPQueue
+{
+  PacketQueue pipeInfo;
+  ink_hrtime last_report;
+  ink_hrtime last_service;
+  int packets;
+  int added;
+
+
+public:
+  InkAtomicList atomicQueue;
+
+  void service(UDPNetHandler *);
+
+  void SendPackets();
+  void SendUDPPacket(UDPPacketInternal * p, int32_t pktLen);
+
+  // Interface exported to the outside world
+  void send(UDPPacket * p);
+
+  UDPQueue();
+  ~UDPQueue();
+};
+
+
 void initialize_thread_for_udp_net(EThread * thread);
 
 struct UDPNetHandler: public Continuation
@@ -334,8 +338,4 @@ get_UDPNetHandler(EThread * t)
   return (UDPNetHandler *)ETHREAD_GET_PTR(t, udpNetInternal.udpNetHandler_offset);
 }
 
-// All of this stuff is for UDP egress b/w management
-// ToDo: It'd be nice to eliminate this entirely.... But we have no working use of UDPNet afaik. /leif
-extern PacketQueue G_inkPipeInfo;
-
 #endif //__P_UDPNET_H_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a544466d/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index 446e349..ca428cb 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -58,8 +58,6 @@ int32_t g_udp_numSendRetries;
 // Public functions
 // See header for documentation
 //
-PacketQueue G_inkPipeInfo;
-
 int G_bwGrapherFd;
 sockaddr_in6 G_bwGrapherLoc;
 
@@ -677,11 +675,11 @@ UDPQueue::service(UDPNetHandler * nh)
       p->conn->lastPktStartTime = pktSendStartTime;
       p->delivery_time = pktSendStartTime;
 
-      G_inkPipeInfo.addPacket(p, now);
+      pipeInfo.addPacket(p, now);
     }
   }
 
-  G_inkPipeInfo.advanceNow(now);
+  pipeInfo.advanceNow(now);
   SendPackets();
 
   timeSpent = ink_hrtime_to_msec(now - last_report);
@@ -715,8 +713,8 @@ sendPackets:
   send_threshold_time = now + SLOT_TIME;
   bytesThisPipe = (int32_t)bytesThisSlot;
 
-  while ((bytesThisPipe > 0) && (G_inkPipeInfo.firstPacket(send_threshold_time))) {
-    p = G_inkPipeInfo.getFirstPacket();
+  while ((bytesThisPipe > 0) && (pipeInfo.firstPacket(send_threshold_time))) {
+    p = pipeInfo.getFirstPacket();
     pktLen = p->getPktLength();
 
     if (p->conn->shouldDestroy())
@@ -740,14 +738,14 @@ sendPackets:
   if ((bytesThisSlot > 0) && sentOne) {
     // redistribute the slack...
     now = ink_get_hrtime_internal();
-    if (G_inkPipeInfo.firstPacket(now) == NULL) {
-      G_inkPipeInfo.advanceNow(now);
+    if (pipeInfo.firstPacket(now) == NULL) {
+      pipeInfo.advanceNow(now);
     }
     goto sendPackets;
   }
 
   if ((g_udp_periodicFreeCancelledPkts) && (now - lastCleanupTime > ink_hrtime_from_sec(g_udp_periodicFreeCancelledPkts))) {
-    G_inkPipeInfo.FreeCancelledPackets(g_udp_periodicCleanupSlots);
+    pipeInfo.FreeCancelledPackets(g_udp_periodicCleanupSlots);
     lastCleanupTime = now;
   }
 }


[12/50] git commit: TS-1067 Remove the UDPWorkContinuation code

Posted by zw...@apache.org.
TS-1067 Remove the UDPWorkContinuation code


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

Branch: refs/heads/3.3.x
Commit: f8a6791be894ae8b1db6ce41a31b5e9fbc7a90f2
Parents: 9bb4afb
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 08:39:06 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:52:33 2013 -0600

----------------------------------------------------------------------
 iocore/net/I_UDPConnection.h |    9 +-
 iocore/net/I_UDPNet.h        |    8 --
 iocore/net/P_UDPNet.h        |   34 -------
 iocore/net/UnixUDPNet.cc     |  199 -------------------------------------
 4 files changed, 4 insertions(+), 246 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8a6791b/iocore/net/I_UDPConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPConnection.h b/iocore/net/I_UDPConnection.h
index ab55181..045f376 100644
--- a/iocore/net/I_UDPConnection.h
+++ b/iocore/net/I_UDPConnection.h
@@ -97,12 +97,11 @@ public:
   /**
      Put socket on net queue for read/write polling.
 
-     Not required for UDPConnections created with
-     UDPNetProcessor::UDPBind
+     Not required for UDPConnections created with UDPNetProcessor::UDPBind
 
-     Required for UDPNetProcessor::UDPCreatePortPairs  and
-     UDPNetProcessor::CreateUDPSocket.  They  don't do bindToThread()
-     automatically so that the sockets can be passed to other Continuations.
+     Required for  and UDPNetProcessor::CreateUDPSocket.  They  don't do
+     bindToThread() automatically so that the sockets can be passed to
+     other Continuations.
   */
   void bindToThread(Continuation * c);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8a6791b/iocore/net/I_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPNet.h b/iocore/net/I_UDPNet.h
index d9dc38b..5497fbd 100644
--- a/iocore/net/I_UDPNet.h
+++ b/iocore/net/I_UDPNet.h
@@ -84,14 +84,6 @@ public:
   // The mess again: the complier won't let me stick UDPConnection here.
   void UDPClassifyConnection(Continuation * udpConn, IpAddr const& addr);
 
-  // create pairs of UDPConnections in which the first connection is
-  // on a even-#'ed port and the second connection is on the next
-  // odd-#'ed port.  Create "nPairs" of such connections.
-  Action *UDPCreatePortPairs(Continuation *, int nPairs,
-    sockaddr const* local_addr,
-    sockaddr const* remote_addr,
-    int send_bufsize = 0, int recv_bufsize = 0);
-
   // Regarding sendto_re, sendmsg_re, recvfrom_re:
   // * You may be called back on 'c' with completion or error status.
   // * 'token' is an opaque which can be used by caller to match up the I/O

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8a6791b/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index 8a3cfb8..31a2492 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -386,38 +386,4 @@ struct InkPipeInfo
 
 extern InkPipeInfo G_inkPipeInfo;
 
-class UDPWorkContinuation:public Continuation
-{
-public:
-  UDPWorkContinuation():cont(NULL), numPairs(0), 
-    sendbufsize(0), recvbufsize(0), udpConns(NULL), resultCode(NET_EVENT_DATAGRAM_OPEN)
-  {
-    memset(&local_ip, 0, sizeof(local_ip));
-    memset(&remote_ip, 0, sizeof(remote_ip));
-  };
-  ~UDPWorkContinuation() {
-  };
-  void init(Continuation * c, int num_pairs,
-    sockaddr const* local_ip,
-    sockaddr const* remote_ip,
-    int s_bufsize, int r_bufsize);
-  int StateCreatePortPairs(int event, void *data);
-  int StateDoCallback(int event, void *data);
-
-  Action action;
-
-private:
-  Continuation * cont;
-  int numPairs;
-  IpEndpoint local_ip; ///< replaces myIP.
-  IpEndpoint remote_ip; ///< replaces destIP.
-  int sendbufsize, recvbufsize;
-  UnixUDPConnection **udpConns;
-  int resultCode;
-};
-
-typedef int (UDPWorkContinuation::*UDPWorkContinuation_Handler) (int, void *);
-
-inkcoreapi extern ClassAllocator<UDPWorkContinuation> udpWorkContinuationAllocator;
-
 #endif //__P_UDPNET_H_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8a6791b/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index 73dc0f6..79dd8da 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -35,9 +35,6 @@
 typedef int (UDPNetHandler::*UDPNetContHandler) (int, void *);
 
 inkcoreapi ClassAllocator<UDPPacketInternal> udpPacketAllocator("udpPacketAllocator");
-
-inkcoreapi ClassAllocator<UDPWorkContinuation> udpWorkContinuationAllocator("udpWorkContinuationAllocator");
-
 EventType ET_UDP;
 
 #if defined(linux) && !defined(DEBUG)
@@ -514,23 +511,6 @@ UDPNetProcessor::sendto_re(Continuation * cont,
   }
 }
 
-Action *
-UDPNetProcessor::UDPCreatePortPairs(
-  Continuation * cont,
-  int nPairs,
-  sockaddr const* local_addr,
-  sockaddr const* remote_addr,
-  int send_bufsize, int recv_bufsize
-) {
-
-  UDPWorkContinuation *worker = udpWorkContinuationAllocator.alloc();
-  // UDPWorkContinuation *worker = NEW(new UDPWorkContinuation);
-
-  worker->init(cont, nPairs, local_addr, remote_addr, send_bufsize, recv_bufsize);
-  eventProcessor.schedule_imm(worker, ET_UDP);
-  return &(worker->action);
-}
-
 
 bool
 UDPNetProcessor::CreateUDPSocket(
@@ -1135,182 +1115,3 @@ UDPNetHandler::mainNetEvent(int event, Event * e)
 
   return EVENT_CONT;
 }
-
-/////////////////////////////////////////////////////////////////////
-//
-// A helper continuation that creates a pair of UDP ports in a non-blocking
-// way.  This continuation runs on the UDP thread; a run lasts for at most 500ms.
-//
-/////////////////////////////////////////////////////////////////////
-
-void
-UDPWorkContinuation::init(Continuation * c, int num_pairs,
-  sockaddr const* local_addr,
-  sockaddr const* remote_addr,
-  int s_bufsize, int r_bufsize
-) {
-  mutex = c->mutex;
-  cont = c;
-  action = c;
-  numPairs = num_pairs;
-  ats_ip_copy(&local_ip, local_addr);
-  ats_ip_copy(&remote_ip, remote_addr);
-  sendbufsize = s_bufsize;
-  recvbufsize = r_bufsize;
-  udpConns = NULL;
-  SET_HANDLER((UDPWorkContinuation_Handler) & UDPWorkContinuation::StateCreatePortPairs);
-}
-
-int
-UDPWorkContinuation::StateCreatePortPairs(int event, void *data)
-{
-  NOWARN_UNUSED(event);
-  NOWARN_UNUSED(data);
-//  int res = 0;
-  int numUdpPorts = 2 * numPairs;
-  int fd1 = -1, fd2 = -1;
-  IpEndpoint target;
-  IpEndpoint myaddr1, myaddr2;
-  int portNum, i;
-//  int myaddr_len = sizeof(myaddr1);
-  static int lastAllocPort = 10000;
-  ink_hrtime startTime, endTime;
-  Action *status;
-  //epoll changes
-
-  PollCont *pc = NULL;
-  //epoll changes ends here
-  ink_debug_assert(mutex->thread_holding == this_ethread());
-
-  if (action.cancelled) {
-    action = NULL;
-    mutex = NULL;
-    udpWorkContinuationAllocator.free(this);
-    return EVENT_CONT;
-  }
-
-  startTime = ink_get_hrtime_internal();
-  ats_ip_copy(&target, &remote_ip);
-
-  udpConns = NEW(new UnixUDPConnection *[numUdpPorts]);
-  for (i = 0; i < numUdpPorts; i++)
-    udpConns[i] = NULL;
-  ink_atomic_swap(&portNum, lastAllocPort);
-  portNum %= 50000;
-  if (portNum == 0)
-    portNum = 10000;
-
-  i = 0;
-  while (i < numUdpPorts) {
-
-    int myaddr1_len = sizeof(myaddr1);
-    int myaddr2_len = sizeof(myaddr2);
-    ats_ip_port_cast(&target) = htons(portNum);
-    if (udpNet.CreateUDPSocket(&fd1, 
-        &target.sa, 
-        &myaddr1.sa,
-        &myaddr1_len,
-        &status, sendbufsize, recvbufsize)) {
-      ats_ip_port_cast(&target) = htons(portNum + 1);
-      if (udpNet.CreateUDPSocket(&fd2, 
-        &target.sa, 
-        &myaddr2.sa,
-        &myaddr2_len,
-        &status, sendbufsize, recvbufsize)) {
-        udpConns[i] = NEW(new UnixUDPConnection(fd1));        // new_UnixUDPConnection(fd1);
-        udpConns[i]->setBinding(&myaddr1.sa);
-        i++;
-        udpConns[i] = NEW(new UnixUDPConnection(fd2));        // new_UnixUDPConnection(fd2);
-        udpConns[i]->setBinding(&myaddr2.sa);
-        i++;
-        // remember the last alloc'ed port
-        ink_atomic_swap(&lastAllocPort, portNum + 2);
-      } else {
-        if (fd1 != NO_FD)
-          socketManager.close(fd1);
-        if (status == ACTION_IO_ERROR)
-          goto Lerror;
-      }
-      Debug("udpnet", "Created port pair with ports = %d, %d", portNum, portNum + 1);
-    } else if (status == ACTION_IO_ERROR)
-      goto Lerror;
-    // pick the next port pair value
-    portNum += 2;
-    // wrap around at 50K
-    portNum %= 50000;
-    if (portNum == 0)
-      portNum = 10000;
-    endTime = ink_get_hrtime_internal();
-    // if we spend more than 500 ms. bail!
-    if (ink_hrtime_to_msec(endTime - startTime) > 500) {
-      status = ACTION_IO_ERROR;
-      goto Lerror;
-    }
-
-  }
-
-  for (i = 0; i < numUdpPorts; i++) {
-    udpNet.UDPClassifyConnection(udpConns[i], IpAddr(target));
-    Debug("udpnet-pipe", "Adding (port = %d) to Pipe class: %d",
-          udpConns[i]->getPortNum(), udpConns[i]->pipe_class);
-  }
-
-  // assert should *never* fire; we check for this at the begin of the func.
-  ink_assert(!action.cancelled);
-
-  // Bind to threads only on a success.  Currently, after you have
-  // bound to have a thread, the only way to remove a UDPConnection is
-  // to call destroy(); the thread to which the UDPConnection will
-  // remove the connection from a linked list and call delete.
-
-  for (i = 0; i < numUdpPorts; i++) {
-    udpConns[i]->bindToThread(cont);
-    pc = get_UDPPollCont(udpConns[i]->ethread);
-    udpConns[i]->ep.start(pc->pollDescriptor, udpConns[i], EVENTIO_READ);
-  }
-
-  resultCode = NET_EVENT_DATAGRAM_OPEN;
-  goto out;
-
-Lerror:
-  resultCode = NET_EVENT_DATAGRAM_ERROR;
-  for (i = 0; i < numUdpPorts; i++)
-    delete udpConns[i];
-  delete[] udpConns;
-  udpConns = NULL;
-
-out:
-  SET_HANDLER((UDPWorkContinuation_Handler) & UDPWorkContinuation::StateDoCallback);
-  return StateDoCallback(0, NULL);
-}
-
-int
-UDPWorkContinuation::StateDoCallback(int event, void *data)
-{
-  NOWARN_UNUSED(event);
-  NOWARN_UNUSED(data);
-  MUTEX_TRY_LOCK(lock, action.mutex, this_ethread());
-  if (!lock) {
-    this_ethread()->schedule_in(this, MUTEX_RETRY_DELAY);
-    return EVENT_CONT;
-  }
-  if (!action.cancelled) {
-    action.continuation->handleEvent(resultCode, udpConns);
-  } else {
-    // else action.cancelled
-    if (resultCode == NET_EVENT_DATAGRAM_OPEN) {
-      for (int i = 0; i < numPairs * 2; i++)
-        // don't call delete on individual connections; the udp thread will do
-        // that when it cleans up an fd.
-        udpConns[i]->destroy();
-      delete[]udpConns;       // I think this is OK to delete the array, what we shouldn't do is loop over
-      udpConns = NULL;        // the conns and and do delete udpConns[i].
-    }
-  }
-
-  action = NULL;
-  mutex = NULL;
-  udpWorkContinuationAllocator.free(this);
-
-  return EVENT_CONT;
-}


[37/50] git commit: Fix vagrant VM addressing

Posted by zw...@apache.org.
Fix vagrant VM addressing


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

Branch: refs/heads/3.3.x
Commit: eabab3ef292272a10f5d087450a88fa340f14eb6
Parents: ce58be8
Author: James Peach <jp...@apache.org>
Authored: Thu Apr 4 12:48:56 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Thu Apr 4 12:48:56 2013 -0700

----------------------------------------------------------------------
 Vagrantfile |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/eabab3ef/Vagrantfile
----------------------------------------------------------------------
diff --git a/Vagrantfile b/Vagrantfile
index babfca6..87dd26e 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -15,13 +15,14 @@
 #  limitations under the License.
 
 $network = {
-  "raring64"  => "192.168.100.1",
-  "quantal64" => "192.168.100.2",
-  "precise64" => "192.168.100.3",
-  "lucid64"   => "192.168.100.4",
-  "centos63"  => "192.168.100.5",
-  "freebsd"   => "192.168.100.6",
-  "omnios"    => "192.168.100.7",
+  # The VM host is 192.168.100.1
+  "raring64"  => "192.168.100.11",
+  "quantal64" => "192.168.100.12",
+  "precise64" => "192.168.100.13",
+  "lucid64"   => "192.168.100.14",
+  "centos63"  => "192.168.100.15",
+  "freebsd"   => "192.168.100.16",
+  "omnios"    => "192.168.100.17",
 }
 
 Vagrant.configure("2") do |config|


[38/50] git commit: Drop in libloader code.

Posted by zw...@apache.org.
Drop in libloader code.

Necessary build and docs to follow.


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

Branch: refs/heads/3.3.x
Commit: 5654cf4c4b22e0c81d56f1b8d0afeafaed8a8133
Parents: eabab3e
Author: niq <ni...@apache.org>
Authored: Sat Apr 6 00:32:59 2013 +0100
Committer: niq <ni...@apache.org>
Committed: Sat Apr 6 00:32:59 2013 +0100

----------------------------------------------------------------------
 plugins/libloader/libloader.c |   85 ++++++++++++++++++++++++++++++++++++
 1 files changed, 85 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5654cf4c/plugins/libloader/libloader.c
----------------------------------------------------------------------
diff --git a/plugins/libloader/libloader.c b/plugins/libloader/libloader.c
new file mode 100644
index 0000000..ef84c2f
--- /dev/null
+++ b/plugins/libloader/libloader.c
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (C) 2011-13 Qualys, Inc
+ * Copyright (C) 2013 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * QUALYS licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ****************************************************************************/
+
+/* libloader: load libraries, making all symbols exported
+ * universally visible.  Equivalent to LoadFile in HTTPD.
+ *
+ * Written for ironbee plugin, whose module architecture
+ * is not compatible with trafficserver's plugins.
+ * May be useful for other plugins with non-trivial
+ * library dependencies.
+ */
+
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ts/ts.h>
+
+typedef struct {
+    void *handle;
+    void *next;
+} link_handle;
+
+static link_handle *libs = NULL;
+
+static void unloadlibs(void)
+{
+    link_handle *p = libs;
+    while (p != NULL) {
+        link_handle *next = p->next;
+        dlclose(p->handle);
+        TSfree(p);
+        p = next;
+    }
+    libs = NULL;
+}
+
+void TSPluginInit(int argc, const char *argv[])
+{
+    int i;
+    TSPluginRegistrationInfo info;
+
+    info.plugin_name = (char *)"libloader";
+    info.vendor_name = (char *)"Apache Software Foundation";
+    info.support_email = (char *)"users@trafficserver.apache.org";
+
+    if (TSPluginRegister(TS_SDK_VERSION_3_0, &info) != TS_SUCCESS) {
+        TSError("[libloader] Plugin registration failed.\n");
+        return;
+    }
+
+    atexit(unloadlibs);
+
+    for (i = 1; i < argc; ++i) {
+        const char *lib = argv[i];
+        void *handle = dlopen(lib, RTLD_GLOBAL|RTLD_NOW);
+        if (handle) {
+            link_handle *l = TSmalloc(sizeof(link_handle));
+            l->handle = handle;
+            l->next = libs;
+            libs = l;
+            TSDebug("libloader", " loaded %s\n", lib);
+        }
+        else {
+            TSError("[libloader] failed to load %s: %s\n", lib, dlerror());
+        }
+    }
+    return;
+}


[27/50] git commit: TS-1783 Eliminate the wpad.dat configuration option (it's unused).

Posted by zw...@apache.org.
TS-1783 Eliminate the wpad.dat configuration option (it's unused).


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

Branch: refs/heads/3.3.x
Commit: 86b17cc139ff0580d987b91e49b90106d570e4e7
Parents: 8f7f66a
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Apr 2 17:05:36 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 17:05:36 2013 -0600

----------------------------------------------------------------------
 CHANGES |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/86b17cc1/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index b8321b1..3ee67b2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-1783] Eliminate the wpad.dat configuration option (it's unused).
+
   *) [TS-1787] Eliminate old ink_time code (was probably only used by the
    now obsolete Web UI). This fixes compiling with gcc 4.8 as well.
 


[36/50] git commit: Turn the vagrant file back into actual ruby

Posted by zw...@apache.org.
Turn the vagrant file back into actual ruby


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

Branch: refs/heads/3.3.x
Commit: ce58be869902b40480203883b802e0ffee4f41d8
Parents: 6eb467c
Author: James Peach <jp...@apache.org>
Authored: Thu Apr 4 11:43:08 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Thu Apr 4 11:43:08 2013 -0700

----------------------------------------------------------------------
 Vagrantfile |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ce58be86/Vagrantfile
----------------------------------------------------------------------
diff --git a/Vagrantfile b/Vagrantfile
index f98f415..babfca6 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -15,13 +15,13 @@
 #  limitations under the License.
 
 $network = {
-  raring64: "192.168.100.1",
-  quantal4: "192.168.100.2",
-  precise64:"192.168.100.3",
-  lucid64:  "192.168.100.4",
-  centos63: "192.168.100.5",
-  freebsd:  "192.168.100.6",
-  omnios:   "192.168.100.7",
+  "raring64"  => "192.168.100.1",
+  "quantal64" => "192.168.100.2",
+  "precise64" => "192.168.100.3",
+  "lucid64"   => "192.168.100.4",
+  "centos63"  => "192.168.100.5",
+  "freebsd"   => "192.168.100.6",
+  "omnios"    => "192.168.100.7",
 }
 
 Vagrant.configure("2") do |config|


[29/50] git commit: Teach vagrant that omnios is solaris

Posted by zw...@apache.org.
Teach vagrant that omnios is solaris


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

Branch: refs/heads/3.3.x
Commit: 84df57e0e1e88046422c70fc89dbad5d52c2e820
Parents: 25adb5c
Author: James Peach <jp...@apache.org>
Authored: Tue Apr 2 18:40:16 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Tue Apr 2 20:41:37 2013 -0700

----------------------------------------------------------------------
 Vagrantfile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/84df57e0/Vagrantfile
----------------------------------------------------------------------
diff --git a/Vagrantfile b/Vagrantfile
index 8c7c755..85998e6 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -66,6 +66,7 @@ Vagrant.configure("2") do |config|
   # Current OmniOS release, see http://omnios.omniti.com/wiki.php/Installation
   config.vm.define :omnios do | config |
     config.vm.box = "omnios"
+    config.vm.guest = :solaris
     config.vm.network :private_network, ip: "192.168.100.9"
     config.vm.synced_folder ".", "/opt/src/trafficserver.git", :nfs => false
     config.vm.box_url = "http://omnios.omniti.com/media/omnios-latest.box"


[44/50] git commit: filename_to_string doesn't need to strdup

Posted by zw...@apache.org.
filename_to_string doesn't need to strdup


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

Branch: refs/heads/3.3.x
Commit: 9ff75928c552246b4f729692abc81aed79445dbb
Parents: 116b74e
Author: James Peach <jp...@apache.org>
Authored: Fri Mar 29 13:53:08 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Thu Apr 11 13:05:29 2013 -0700

----------------------------------------------------------------------
 mgmt/api/CfgContextUtils.cc |   64 +++++++++----------------------------
 mgmt/api/CfgContextUtils.h  |    2 +-
 mgmt/api/CoreAPI.cc         |    7 +---
 mgmt/api/include/mgmtapi.h  |    2 +-
 4 files changed, 20 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9ff75928/mgmt/api/CfgContextUtils.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CfgContextUtils.cc b/mgmt/api/CfgContextUtils.cc
index 32cb139..7e458e7 100644
--- a/mgmt/api/CfgContextUtils.cc
+++ b/mgmt/api/CfgContextUtils.cc
@@ -1413,57 +1413,25 @@ round_robin_type_to_string(TSRrT rr)
  *----------------------------------------------------------------------------
  * TSFileNameT ==> string
  */
-char *
+const char *
 filename_to_string(TSFileNameT file)
 {
   switch (file) {
-  case TS_FNAME_CACHE_OBJ:
-    return ats_strdup("cache.config");
-
-  case TS_FNAME_CONGESTION:
-    return ats_strdup("congestion.config");
-
-  case TS_FNAME_HOSTING:
-    return ats_strdup("hosting.config");
-
-  case TS_FNAME_ICP_PEER:
-    return ats_strdup("icp.config");
-
-  case TS_FNAME_IP_ALLOW:
-    return ats_strdup("ip_allow.config");
-
-
-  case TS_FNAME_LOGS_XML:
-    return ats_strdup("logs_xml.config");
-
-  case TS_FNAME_PARENT_PROXY:
-    return ats_strdup("parent.config");
-
-  case TS_FNAME_VOLUME:
-    return ats_strdup("volume.config");
-
-  case TS_FNAME_PLUGIN:
-    return ats_strdup("plugin.config");
-
-  case TS_FNAME_REMAP:
-    return ats_strdup("remap.config");
-
-  case TS_FNAME_SOCKS:
-    return ats_strdup("socks.config");
-
-  case TS_FNAME_SPLIT_DNS:
-    return ats_strdup("splitdns.config");
-
-  case TS_FNAME_STORAGE:
-    return ats_strdup("storage.config");
-
-  case TS_FNAME_UPDATE_URL:
-    return ats_strdup("update.config");
-
-  case TS_FNAME_VADDRS:
-    return ats_strdup("vaddrs.config");
-
-
+  case TS_FNAME_CACHE_OBJ:    return "cache.config";
+  case TS_FNAME_CONGESTION:   return "congestion.config";
+  case TS_FNAME_HOSTING:      return "hosting.config";
+  case TS_FNAME_ICP_PEER:     return "icp.config";
+  case TS_FNAME_IP_ALLOW:     return "ip_allow.config";
+  case TS_FNAME_LOGS_XML:     return "logs_xml.config";
+  case TS_FNAME_PARENT_PROXY: return "parent.config";
+  case TS_FNAME_VOLUME:       return "volume.config";
+  case TS_FNAME_PLUGIN:       return "plugin.config";
+  case TS_FNAME_REMAP:        return "remap.config";
+  case TS_FNAME_SOCKS:        return "socks.config";
+  case TS_FNAME_SPLIT_DNS:    return "splitdns.config";
+  case TS_FNAME_STORAGE:      return "storage.config";
+  case TS_FNAME_UPDATE_URL:   return "update.config";
+  case TS_FNAME_VADDRS:       return "vaddrs.config";
   default:                     /* no such config file */
     return NULL;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9ff75928/mgmt/api/CfgContextUtils.h
----------------------------------------------------------------------
diff --git a/mgmt/api/CfgContextUtils.h b/mgmt/api/CfgContextUtils.h
index 8e91f9b..b6fc86d 100644
--- a/mgmt/api/CfgContextUtils.h
+++ b/mgmt/api/CfgContextUtils.h
@@ -119,7 +119,7 @@ TSRrT string_to_round_robin_type(const char *rr);
 char *round_robin_type_to_string(TSRrT rr);
 
 /* TSFileNameT <==> string */
-char *filename_to_string(TSFileNameT file);
+const char *filename_to_string(TSFileNameT file);
 
 TSCongestionSchemeT string_to_congest_scheme_type(const char *scheme);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9ff75928/mgmt/api/CoreAPI.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc
index c5a1a21..f1aeae3 100644
--- a/mgmt/api/CoreAPI.cc
+++ b/mgmt/api/CoreAPI.cc
@@ -534,7 +534,7 @@ MgmtRecordSetString(const char *rec_name, const char *string_val, TSActionNeedT
 TSError
 ReadFile(TSFileNameT file, char **text, int *size, int *version)
 {
-  char *fname;
+  const char *fname;
   Rollback *file_rb;
   int ret, old_file_len;
   textBuffer *old_file_content;
@@ -551,10 +551,8 @@ ReadFile(TSFileNameT file, char **text, int *size, int *version)
   ret = configFiles->getRollbackObj(fname, &file_rb);
   if (ret != TRUE) {
     Debug("FileOp", "[get_lines_from_file] Can't get Rollback for file: %s\n", fname);
-    ats_free(fname);
     return TS_ERR_READ_FILE;
   }
-  ats_free(fname);
   ver = file_rb->getCurrentVersion();
   file_rb->getVersion(ver, &old_file_content);
   *version = ver;
@@ -586,7 +584,7 @@ ReadFile(TSFileNameT file, char **text, int *size, int *version)
 TSError
 WriteFile(TSFileNameT file, char *text, int size, int version)
 {
-  char *fname;
+  const char *fname;
   Rollback *file_rb;
   textBuffer *file_content;
   int ret;
@@ -603,7 +601,6 @@ WriteFile(TSFileNameT file, char *text, int size, int version)
     mgmt_log(stderr, "[CfgFileIO::WriteFile] ERROR getting rollback object\n");
     //goto generate_error_msg;
   }
-  ats_free(fname);
 
   // if version < 0 then, just use next version in sequence;
   // otherwise check if trying to commit an old version

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9ff75928/mgmt/api/include/mgmtapi.h
----------------------------------------------------------------------
diff --git a/mgmt/api/include/mgmtapi.h b/mgmt/api/include/mgmtapi.h
index 0e9c45e..9e38380 100644
--- a/mgmt/api/include/mgmtapi.h
+++ b/mgmt/api/include/mgmtapi.h
@@ -368,7 +368,7 @@ extern "C"
     TS_FNAME_IP_ALLOW,         /* ip_allow.config */
     TS_FNAME_LOGS_XML,         /* logs_xml.config */
     TS_FNAME_PARENT_PROXY,     /* parent.config */
-    TS_FNAME_VOLUME,        /* volume.config */
+    TS_FNAME_VOLUME,           /* volume.config */
     TS_FNAME_PLUGIN,           /* plugin.config */
     TS_FNAME_REMAP,            /* remap.config */
     TS_FNAME_SOCKS,            /* socks.config */


[24/50] git commit: TS-1787 gcc 4.8 complains about uninitialized struct tm

Posted by zw...@apache.org.
TS-1787 gcc 4.8 complains about uninitialized struct tm


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

Branch: refs/heads/3.3.x
Commit: ce893d72f9521dfea0d2b71b16c6a8186cec6453
Parents: 5cf774a
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Mar 28 13:54:29 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 16:53:58 2013 -0600

----------------------------------------------------------------------
 lib/ts/ink_time.cc          |  646 --------------------------------------
 lib/ts/ink_time.h           |   83 +-----
 proxy/congest/Congestion.cc |    2 +-
 3 files changed, 8 insertions(+), 723 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ce893d72/lib/ts/ink_time.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_time.cc b/lib/ts/ink_time.cc
index 6b11db4..20b5158 100644
--- a/lib/ts/ink_time.cc
+++ b/lib/ts/ink_time.cc
@@ -93,569 +93,7 @@ ink_time_wall_seconds()
   return ((double) s_val.tv_sec + 0.000001 * s_val.tv_usec);
 }                               /* End ink_time_wall_seconds */
 
-/*===========================================================================*
-
-                          High-Level Date Processing
-
- *===========================================================================*/
-
-/*---------------------------------------------------------------------------*
-
-  int ink_time_gmt_string_to_tm(char *string, struct tm *broken_down_time)
-
-  This routine takes an ASCII string representation of a date <string> in one
-  of several formats, converts the string to a calendar time, and stores the
-  calendar time through the pointer <broken_down_time>.
-
-  This routine currently attempts to support RFC 1123 format, RFC 850
-  format, and asctime() format.  The times are expected to be in GMT time.
-
-  If the string is successfully parsed and converted to a date, the number
-  of characters processed from the string is returned (useful for scanning
-  over a string), otherwise 0 is returned.
-
- *---------------------------------------------------------------------------*/
-int
-ink_time_gmt_string_to_tm(char *string, struct tm *bdt)
-{
-  char *result;
-
-  /* This declaration isn't being found in time.h for some reason */
-
-  result = NULL;
-
-  /* Try RFC 1123 Format */
-
-  if (!result)
-    result = strptime(string, (char *) "%a, %d %b %Y %T GMT", bdt);
-  if (!result)
-    result = strptime(string, (char *) "%a, %d %b %Y %T UTC", bdt);
-
-  /* Try RFC 850 Format */
-
-  if (!result)
-    result = strptime(string, (char *) "%A, %d-%b-%y %T GMT", bdt);
-  if (!result)
-    result = strptime(string, (char *) "%A, %d-%b-%y %T UTC", bdt);
-
-  /* Try asctime() Format */
-
-  if (!result)
-    result = strptime(string, (char *) "%a %b %d %T %Y", bdt);
-
-  bdt->tm_isdst = -1;
-
-  /* If No Success, You Lose, Pal */
-
-  if (!result)
-    return (0);
-
-  return (result - string);
-}                               /* End ink_time_gmt_string_to_tm */
-
-
-/*---------------------------------------------------------------------------*
-
-  int ink_time_gmt_tm_to_rfc1123_string(struct tm *t, char *string, int maxsize)
-
-  This routine takes a calendar time <tm> in universal time, and converts
-  the time to an RFC 1123 formatted string as in "Sun, 06 Nov 1994 08:49:37 GMT",
-  which is placed in the string <string> up to <maxsize> bytes.  1 is
-  returned on success, else 0.
-
- *---------------------------------------------------------------------------*/
-int
-ink_time_gmt_tm_to_rfc1123_string(struct tm *t, char *string, int maxsize)
-{
-  size_t size;
-
-  size = strftime(string, maxsize, "%a, %d %b %Y %T GMT", t);
-  if (size == 0) {
-    if (maxsize > 0)
-      string[0] = '\0';
-    return (0);
-  }
-  return (1);
-}                               /* End ink_time_gmt_tm_to_rfc1123_string */
-
-
-/*---------------------------------------------------------------------------*
-
-  InkTimeDayID ink_time_tm_to_dayid(struct tm *t)
-
-  This routine takes a broken-down time <t>, and converts it to an
-  InkTimeDayID <dayid>, representing an integer number of days since a base.
-
- *---------------------------------------------------------------------------*/
-InkTimeDayID
-ink_time_tm_to_dayid(struct tm * t)
-{
-  int m, dom, y;
-  InkTimeDayID dayid;
-
-  ink_time_tm_to_mdy(t, &m, &dom, &y);
-  dayid = ink_time_mdy_to_dayid(m, dom, y);
-  return (dayid);
-}                               /* End ink_time_tm_to_dayid */
-
-
-/*---------------------------------------------------------------------------*
-
-  void ink_time_dump_dayid(FILE *fp, InkTimeDayID dayid)
-
-  This routine prints an ASCII representation of <dayid> onto the file
-  pointer <fp>.
-
- *---------------------------------------------------------------------------*/
-void
-ink_time_dump_dayid(FILE * fp, InkTimeDayID dayid)
-{
-  int m, d, y;
-
-  ink_time_dayid_to_mdy(dayid, &m, &d, &y);
-  fprintf(fp, "dayid %d (%d/%d/%d)\n", dayid, m, d, y);
-}                               /* End ink_time_dump_dayid */
-
-
-/*---------------------------------------------------------------------------*
-
-  void ink_time_dayid_to_tm(InkTimeDayID dayid, struct tm *t)
-
-  This routine takes an InkTimeDayID <dayid>, representing an integer number
-  of days since a base, and computes a broken-down time <t>.
-
- *---------------------------------------------------------------------------*/
-void
-ink_time_dayid_to_tm(InkTimeDayID dayid, struct tm *t)
-{
-  int m, dom, y;
-
-  ink_time_dayid_to_mdy(dayid, &m, &dom, &y);
-  ink_time_mdy_to_tm(m, dom, y, t);
-}                               /* End ink_time_dayid_to_tm */
-
-
-/*---------------------------------------------------------------------------*
-
-  InkTimeDayRange ink_time_dayid_to_dayrange(InkTimeDayID dayid, unsigned int width)
-
-  This routine takes a <dayid> representing a particular day, and returns
-  an InkTimeDayRange object of width <width> that spans the day in question.
-
- *---------------------------------------------------------------------------*/
-InkTimeDayRange
-ink_time_dayid_to_dayrange(InkTimeDayID dayid, unsigned int width)
-{
-  InkTimeDayRange range;
-
-  range.base = dayid - (dayid % width);
-  range.width = width;
-  return (range);
-}                               /* End ink_time_dayid_to_dayrange */
-
-
-/*---------------------------------------------------------------------------*
-
-  InkTimeDayRange ink_time_chomp_off_mouthful_of_dayrange
-	(InkTimeDayRange *dayrange_ptr, unsigned int biggest_width)
-
-  This routine takes a dayrange pointer <dayrange_ptr>, and bites off the
-  biggest possible chunk of the dayrange pointed to by <dayrange_ptr>
-  which is less than or equal to <biggest_width> and whose chunk is
-  "chomp aligned", meaning that the start of the dayrange chunk starts on
-  a multiple of the width.
-
-  The value <biggest_width> must be a positive power of two.
-
-  On exit, the chunk chomped off will be returned, and the original
-  dayrange pointed to by <dayrange_ptr> will be modified to consist of
-  the data after the chunk that was chopped off.
-
-  If the dayrange pointed to by <dayrange_ptr> has no size, a dayrange
-  of size 0 is returned, and the original data is unmodified.
-
-  The purpose of this routine is to decompose a range of consecutive days
-  into a collection of variable-sized, disjoint day ranges which cover the
-  original space of days.
-
- *---------------------------------------------------------------------------*/
-InkTimeDayRange
-ink_time_chomp_off_mouthful_of_dayrange(InkTimeDayRange * dayrange_ptr, unsigned int biggest_width)
-{
-  unsigned int width;
-  InkTimeDayRange chomped_chunk;
-
-  chomped_chunk.base = dayrange_ptr->base;
-
-  for (width = biggest_width; width >= 1; width = width / 2) {
-    if ((width <= dayrange_ptr->width) && ((dayrange_ptr->base % width) == 0)) {
-      chomped_chunk.width = width;
-
-      dayrange_ptr->base += width;
-      dayrange_ptr->width -= width;
-
-      return (chomped_chunk);
-    }
-  }
-
-  chomped_chunk.width = 0;
-
-  return (chomped_chunk);
-}                               /* End ink_time_chomp_off_mouthful_of_dayrange */
-
-
-/*---------------------------------------------------------------------------*
-
-  char *ink_time_dayrange_to_string(InkTimeDayRange *dayrange_ptr, char *buf)
-
-  This routine take a day range pointer <dayrange_ptr>, and places a string
-  representation of the day range in the buffer <buf>.  The buffer must be
-  big enough to hold the representation of the dayrange.
-
-  Of course, you shouldn't have any idea what the representation is, so I
-  guess you're hosed.  Something like 64 characters is probably reasonable.
-
-  The pointer <buf> is returned.
-
- *---------------------------------------------------------------------------*/
-char *
-ink_time_dayrange_to_string(InkTimeDayRange * dayrange_ptr, char *buf, const size_t bufSize)
-{
-  if (bufSize > 0) {
-    buf[0] = '\0';
-  }
-
-  snprintf(buf, bufSize, "range_start_%d_width_%u", dayrange_ptr->base, dayrange_ptr->width);
-  return (buf);
-}                               /* End ink_time_dayrange_to_string */
-
-
-/*===========================================================================*
-
-                          Date Conversion Routines
-
-  Note that both the day of month and the month number start at 1 not zero,
-  so January 1 is <m=1,d=1> not <m=0,d=0>.
-
- *===========================================================================*/
-
-static int _base_day = 4;       /* 1/1/1970 is Thursday */
-static int _base_year = 1970;
-
-static int _base_daysinmonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-
-static const char *_day_names[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
-static const char *_month_names[12] = {
-  "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-
-
-/*---------------------------------------------------------------------------*
-
-  void ink_time_current_mdy(int *m, int *dom, int *y)
-
-  Gets the current local date in GMT, and returns the month, day of month,
-  and year in GMT.
-
- *---------------------------------------------------------------------------*/
-void
-ink_time_current_mdy(int *m, int *dom, int *y)
-{
-  time_t c;
-  struct tm t;
-  c = time(0);
-  ink_gmtime_r(&c, &t);
-  ink_time_tm_to_mdy(&t, m, dom, y);
-}                               /* End ink_time_current_mdy */
-
-
-/*---------------------------------------------------------------------------*
-
-  void ink_time_tm_to_mdy(struct tm *t, int *m, int *dom, int *y)
-
-  Takes a broken down time pointer <t>, and returns the month, day of month,
-  and year.
-
- *---------------------------------------------------------------------------*/
-void
-ink_time_tm_to_mdy(struct tm *t, int *m, int *dom, int *y)
-{
-  *m = t->tm_mon + 1;
-  *dom = t->tm_mday;
-  *y = t->tm_year + 1900;
-}                               /* End ink_time_tm_to_mdy */
-
-
-/*---------------------------------------------------------------------------*
-
-  void ink_time_mdy_to_tm(int m, int dom, int y, struct tm *t)
-
-  Takes a month <m>, day of month <dom>, and year <y>, and places a
-  broken-down time in the structure pointed to by <t>.
-
- *---------------------------------------------------------------------------*/
-void
-ink_time_mdy_to_tm(int m, int dom, int y, struct tm *t)
-{
-  bzero((char *) t, sizeof(*t));
-  t->tm_mon = m - 1;
-  t->tm_mday = dom;
-  t->tm_year = y - 1900;
-  t->tm_wday = ink_time_mdy_to_dow(m, dom, y);
-  t->tm_yday = ink_time_mdy_to_doy(m, dom, y);
-}                               /* End ink_time_mdy_to_tm */
-
-
-/*---------------------------------------------------------------------------*
-
-  InkTimeDayID ink_time_mdy_to_dayid(int m, int dom, int y)
-
-  Return a single integer representing encoding of the day <m> <dom>, <y>.
-  The encoding is performed with respect to the base day.
-
- *---------------------------------------------------------------------------*/
-InkTimeDayID
-ink_time_mdy_to_dayid(int m, int dom, int y)
-{
-  int year, month;
-  InkTimeDayID dayid;
-
-  dayid = 0;
-  for (year = _base_year; year < y; year++)
-    dayid = dayid + ink_time_days_in_year(year);
-  for (month = 1; month < m; month++)
-    dayid = dayid + ink_time_days_in_month(month, year);
-  dayid = dayid + dom - 1;
-  return (dayid);
-}                               /* End ink_time_mdy_to_dayid */
-
-
-/*---------------------------------------------------------------------------*
-
-  InkTimeDayID ink_time_current_dayid()
-
-  Return a single integer representing encoding of the today's date.
-  The encoding is performed with respect to the base day.
-
- *---------------------------------------------------------------------------*/
-InkTimeDayID
-ink_time_current_dayid()
-{
-  InkTimeDayID today;
-  int today_m, today_d, today_y;
-
-  ink_time_current_mdy(&today_m, &today_d, &today_y);
-  today = ink_time_mdy_to_dayid(today_m, today_d, today_y);
-
-  return (today);
-}                               /* End ink_time_current_dayid */
-
-
-/*---------------------------------------------------------------------------*
-
-  void ink_time_dayid_to_mdy(InkTimeDayID dayid, int *mp, int *dp, int *yp)
-
-  Takes a single integer representation of the date, and convert to the
-  month <m>, day of month <dom>, and year <y>.
-
- *---------------------------------------------------------------------------*/
-void
-ink_time_dayid_to_mdy(InkTimeDayID dayid, int *mp, int *dp, int *yp)
-{
-  dayid = dayid + 1;
-  for (*yp = _base_year; ink_time_days_in_year(*yp) < dayid; (*yp)++)
-    dayid = dayid - ink_time_days_in_year(*yp);
-  for (*mp = 1; ink_time_days_in_month(*mp, *yp) < dayid; (*mp)++)
-    dayid = dayid - ink_time_days_in_month(*mp, *yp);
-  *dp = dayid;
-}                               /* End ink_time_dayid_to_mdy */
-
-
-/*---------------------------------------------------------------------------*
-
-  int ink_time_mdy_to_doy(int m, int dom, int y)
-
-  Takes a date <m> <dom> <y>, and returns the number of days into year <y>.
-
- *---------------------------------------------------------------------------*/
-int
-ink_time_mdy_to_doy(int m, int dom, int y)
-{
-  InkTimeDayID first, current;
-
-  first = ink_time_mdy_to_dayid(1, 1, y);
-  current = ink_time_mdy_to_dayid(m, dom, y);
-  return (current - first);
-}                               /* End ink_time_mdy_to_doy */
-
-
-/*---------------------------------------------------------------------------*
-
-  void ink_time_doy_to_mdy(int doy, int year, int *mon, int *dom, int *dow)
-
-  This routine take a <year>, and a zero-based <doy> within the year,
-  and determines the corresponding month, day of month, and day of week.
-
- *---------------------------------------------------------------------------*/
-void
-ink_time_doy_to_mdy(int doy, int year, int *mon, int *dom, int *dow)
-{
-  int month, daysinmonth, days_so_far, next_days_so_far;
-
-  days_so_far = 1;
-  for (month = 1; month <= 12; month++) {
-    daysinmonth = ink_time_days_in_month(month, year);
-    next_days_so_far = days_so_far + daysinmonth;
-    if (doy >= days_so_far && doy < next_days_so_far) {
-      *mon = month;
-      *dom = doy - days_so_far + 1;
-      *dow = ink_time_mdy_to_dow(month, *dom, year);
-      return;
-    }
-    days_so_far = next_days_so_far;
-  }
-}                               /* End ink_time_doy_to_mdy */
-
-
-/*---------------------------------------------------------------------------*
-
-  int ink_time_mdy_to_dow(int month, int dom, int year)
-
-  What day of the week does <month> <dom>, <year> fall on?
-
- *---------------------------------------------------------------------------*/
-int
-ink_time_mdy_to_dow(int month, int dom, int year)
-{
-  int i, base;
-
-  base = ink_time_first_day_of_year(year);
-  for (i = 0; i < month - 1; i++) {
-    base = (base + ink_time_days_in_month(i + 1, year)) % 7;
-  }
-  return ((base + dom - 1) % 7);
-}                               /* End ink_time_mdy_to_dow */
-
-
-/*---------------------------------------------------------------------------*
-
-  int ink_time_days_in_month(int month, int year)
-
-  This routine returns the number of days in a particular <month> and <year>.
-
- *---------------------------------------------------------------------------*/
-int
-ink_time_days_in_month(int month, int year)
-{
-  return (_base_daysinmonth[month - 1] + (month == 2 ? ink_time_leap_year_correction(year) : 0));
-}                               /* End ink_time_days_in_month */
-
-
-/*---------------------------------------------------------------------------*
-
-  int ink_time_days_in_year(int year)
-
-  This routine returns the number of days in the year <year>, compensating
-  for leap years.
-
- *---------------------------------------------------------------------------*/
-int
-ink_time_days_in_year(int year)
-{
-  return (365 + ink_time_leap_year_correction(year));
-}                               /* End ink_time_days_in_year */
-
-
-/*---------------------------------------------------------------------------*
-
-  int ink_time_first_day_of_year(int year)
-
-  What day is January 1 on in this year?
-
- *---------------------------------------------------------------------------*/
-int
-ink_time_first_day_of_year(int year)
-{
-  int i, base;
-
-  base = _base_day;
-  if (year > _base_year) {
-    for (i = _base_year; i < year; i++)
-      base = (base + ink_time_days_in_year(i)) % 7;
-  } else if (year < _base_year) {
-    for (i = _base_year - 1; i >= year; i--)
-      base = ((base - ink_time_days_in_year(i)) % 7 + 7) % 7;
-  }
-  return (base);
-}                               /* End ink_time_first_day_of_year */
-
-
-/*---------------------------------------------------------------------------*
-
-  void ink_time_day_to_string(int day, char *buffer)
-
-  This routine takes a day number and places a 3 character, NUL terminated
-  string representing this day in the buffer pointed to by <buffer>.
-
- *---------------------------------------------------------------------------*/
-void
-ink_time_day_to_string(int day, char *buffer, const size_t bufferSize)
-{
-  ink_strlcpy(buffer, _day_names[day], bufferSize);
-}                               /* End ink_time_day_to_string */
-
-
-/*---------------------------------------------------------------------------*
-
-  void ink_time_month_to_string(int month, char *buffer)
-
-  This routine takes a month number and places a 3 character, NUL terminated
-  string representing this day in the buffer pointed to by <buffer>.
-
- *---------------------------------------------------------------------------*/
-void
-ink_time_month_to_string(int month, char *buffer, const size_t bufferSize)
-{
-  ink_strlcpy(buffer, _month_names[month - 1], bufferSize);
-}                               /* End ink_time_month_to_string */
-
-
-/*---------------------------------------------------------------------------*
-
-  int ink_time_string_to_month(char *str)
 
-  This routine takes a name of a month <str>, and returns the corresponding
-  month number, else -1.
-
- *---------------------------------------------------------------------------*/
-int
-ink_time_string_to_month(char *str)
-{
-  int i;
-
-  for (i = 0; i < 12; i++) {
-    if (strcasecmp(str, _month_names[i]) == 0)
-      return (i + 1);
-  }
-  return (-1);
-}                               /* End ink_time_string_to_month */
-
-
-/*---------------------------------------------------------------------------*
-
-  int ink_time_leap_year_correction(int year)
-
-  Return 1 if <year> is a leap year, 0 if not, and -1 if negative leap year.
-
- *---------------------------------------------------------------------------*/
-int
-ink_time_leap_year_correction(int year)
-{
-  return (ink_time_is_4th_year(year) - ink_time_is_100th_year(year) + ink_time_is_400th_year(year));
-}                               /* End ink_time_leap_year_correction */
-
-/* asah #ifndef sun asah */
 struct dtconv
 {
   char *abbrev_month_names[12];
@@ -669,7 +107,6 @@ struct dtconv
   char *pm_string;
   char *ldate_format;
 };
-/* asah #endif asah */
 
 
 
@@ -703,89 +140,6 @@ cftime(char *s, char *format, const time_t * clock)
 
 #define DAYS_OFFSET  25508
 
-int
-ink_gmtime_r(const ink_time_t * clock, struct tm *res)
-{
-  static const char months[] = {
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
-    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4,
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5,
-    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
-    6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
-    6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7,
-    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-    7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8,
-    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
-    8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,
-    9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
-    9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-    10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-    10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-    11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-    11, 11, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
-  };
-  static const int days[12] = {
-    305, 336, -1, 30, 60, 91, 121, 152, 183, 213, 244, 274
-  };
-
-  size_t t = *clock;
-
-  size_t d, dp;
-
-  size_t sec = t % 60;
-  t /= 60;
-  size_t min = t % 60;
-  t /= 60;
-  size_t hour = t % 24;
-  t /= 24;
-
-  /* Jan 1, 1970 was a Thursday */
-  size_t wday = (4 + t) % 7;
-
-  /* guess the year and refine the guess */
-  size_t yday = t;
-  size_t year = yday / 365 + 69;
-
-  d = dp = (year * 365) + (year / 4) - (year / 100) + (year / 100 + 3) / 4 - DAYS_OFFSET - 1;
-
-  while (dp < yday) {
-    d = dp;
-    year += 1;
-    dp = (year * 365) + (year / 4) - (year / 100) + (year / 100 + 3) / 4 - DAYS_OFFSET - 1;
-  }
-
-  /* convert the days */
-  d = yday - d;
-  if (d> 366)
-    return -1;
-
-  size_t month = months[d];
-  if (month > 1)
-    year -= 1;
-
-  size_t mday = d - days[month] - 1;
-  // year += 1900; real year
-
-  res->tm_sec = (int) sec;
-  res->tm_min = (int) min;
-  res->tm_hour = (int) hour;
-  res->tm_mday = (int) mday;
-  res->tm_mon = (int) month;
-  res->tm_year = (int) year;
-  res->tm_wday = (int) wday;
-  res->tm_yday = (int) yday;
-  res->tm_isdst = 0;
-
-  return 0;
-}
-
 ink_time_t
 convert_tm(const struct tm * tp)
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ce893d72/lib/ts/ink_time.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_time.h b/lib/ts/ink_time.h
index 41ae79e..daffd7a 100644
--- a/lib/ts/ink_time.h
+++ b/lib/ts/ink_time.h
@@ -47,14 +47,6 @@
 
 typedef time_t ink_time_t;
 
-typedef int InkTimeDayID;
-
-typedef struct
-{
-  InkTimeDayID base;
-  unsigned int width;
-} InkTimeDayRange;
-
 /*===========================================================================*
 
                                  Prototypes
@@ -69,65 +61,17 @@ typedef struct
 uint64_t ink_microseconds(int which);
 double ink_time_wall_seconds();
 
-int ink_time_gmt_string_to_tm(char *string, struct tm *bdt);
-int ink_time_gmt_tm_to_rfc1123_string(struct tm *t, char *string, int maxsize);
-
-InkTimeDayID ink_time_tm_to_dayid(struct tm *t);
-void ink_time_dump_dayid(FILE * fp, InkTimeDayID dayid);
-void ink_time_dayid_to_tm(InkTimeDayID dayid, struct tm *t);
-InkTimeDayRange ink_time_dayid_to_dayrange(InkTimeDayID dayid, unsigned int width);
-InkTimeDayRange ink_time_chomp_off_mouthful_of_dayrange(InkTimeDayRange * dayrange_ptr, unsigned int biggest_width);
-char *ink_time_dayrange_to_string(InkTimeDayRange * dayrange_ptr, char *buf);
-
-void ink_time_current_mdy(int *m, int *dom, int *y);
-void ink_time_tm_to_mdy(struct tm *t, int *m, int *dom, int *y);
-void ink_time_mdy_to_tm(int m, int dom, int y, struct tm *t);
-InkTimeDayID ink_time_mdy_to_dayid(int m, int dom, int y);
-InkTimeDayID ink_time_current_dayid();
-void ink_time_dayid_to_mdy(InkTimeDayID dayid, int *mp, int *dp, int *yp);
-int ink_time_mdy_to_doy(int m, int dom, int y);
-void ink_time_doy_to_mdy(int doy, int year, int *mon, int *dom, int *dow);
-int ink_time_mdy_to_dow(int month, int dom, int year);
-int ink_time_days_in_month(int month, int year);
-int ink_time_days_in_year(int year);
-int ink_time_first_day_of_year(int year);
-void ink_time_day_to_string(int day, char *buffer);
-void ink_time_month_to_string(int month, char *buffer);
-int ink_time_string_to_month(char *str);
-int ink_time_leap_year_correction(int year);
-
-/*===========================================================================*
-
-                              Inline Stuffage
-
- *===========================================================================*/
-
-static inline int
-ink_time_is_4th_year(int year)
-{
-  return ((year % 4) == 0);
-}                               /* End ink_time_is_4th_year */
-
-
-static inline int
-ink_time_is_100th_year(int year)
-{
-  return ((year % 100) == 0);
-}                               /* End ink_time_is_100th_year */
-
-
-static inline int
-ink_time_is_400th_year(int year)
-{
-  return ((year % 400) == 0);
-}                               /* End ink_time_is_400th_year */
-
 int cftime_replacement(char *s, int maxsize, const char *format, const time_t * clock);
 #define cftime(s, format, clock) cftime_replacement(s, 8192, format, clock)
 
-inkcoreapi int ink_gmtime_r(const ink_time_t * clock, struct tm *res);
 ink_time_t convert_tm(const struct tm *tp);
 
+inkcoreapi char *ink_ctime_r(const ink_time_t * clock, char *buf);
+inkcoreapi struct tm *ink_localtime_r(const ink_time_t * clock, struct tm *res);
+
+/*===========================================================================*
+                              Inline Stuffage
+ *===========================================================================*/
 #if defined(freebsd) || defined(openbsd)
 
 inline int
@@ -139,15 +83,6 @@ ink_timezone()
   return tzp.tz_minuteswest * 60;
 }
 
-/* vl: not used
-inline int ink_daylight() {
-  struct tm atm;
-  time_t t = time(NULL);
-  ink_assert(!localtime_r(&t, &atm));
-  return atm.tm_isdst;
-}
-*/
-
 #else  // non-freebsd, non-openbsd for the else
 
 inline int
@@ -156,10 +91,6 @@ ink_timezone()
   return timezone;
 }
 
-/* vl: not used - inline int ink_daylight() { return daylight; } */
-#endif
-
-inkcoreapi char *ink_ctime_r(const ink_time_t * clock, char *buf);
-inkcoreapi struct tm *ink_localtime_r(const ink_time_t * clock, struct tm *res);
+#endif /* #if defined(freebsd) || defined(openbsd) */
 
 #endif /* #ifndef _ink_time_h_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ce893d72/proxy/congest/Congestion.cc
----------------------------------------------------------------------
diff --git a/proxy/congest/Congestion.cc b/proxy/congest/Congestion.cc
index f790134..af27304 100644
--- a/proxy/congest/Congestion.cc
+++ b/proxy/congest/Congestion.cc
@@ -709,7 +709,7 @@ CongestionEntry::sprint(char *buf, int buflen, int format)
       if (congestionControlLocalTime) {
         ink_localtime_r(&seconds, &time);
       } else {
-        ink_gmtime_r(&seconds, &time);
+        gmtime_r(&seconds, &time);
       }
       snprintf(str_time, sizeof(str_time), "%04d/%02d/%02d %02d:%02d:%02d",
                    time.tm_year + 1900, time.tm_mon + 1, time.tm_mday, time.tm_hour, time.tm_min, time.tm_sec);


[34/50] git commit: Clean up --enable-luajit help string

Posted by zw...@apache.org.
Clean up --enable-luajit help string


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

Branch: refs/heads/3.3.x
Commit: a34fb9167771373750b0d59f5418a639176dfab9
Parents: 0b2bfcd
Author: James Peach <jp...@apache.org>
Authored: Wed Apr 3 09:53:51 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed Apr 3 10:01:43 2013 -0700

----------------------------------------------------------------------
 configure.ac |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a34fb916/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 7a6145a..dbf1679 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1198,13 +1198,12 @@ AX_LIB_READLINE
 #
 # Check for Lua, at least version 5.1, sets LUA_CFLAGS and LUA_LIBS. We support both standard
 # Lua and LuaJIT, preferring LuaJIT if the user did not indicate a preference.
-AC_ARG_ENABLE([luajit], [
-  AS_HELP_STRING([--enable-luajit], [enable LuaJIT support @<:@default=check@:>@])
-], [
-  enable_luajit="${enableval}"
-], [
-  enable_luajit=check
-])
+AC_MSG_CHECKING([whether to enable Linux LuaJIT support])
+AC_ARG_ENABLE([luajit],
+  [AS_HELP_STRING([--enable-luajit], [enable LuaJIT support @<:@default=check@:>@])],
+  [enable_luajit="${enableval}"],
+  [enable_luajit=check]
+)
 
 PKG_CHECK_MODULES([luajit], [luajit], [have_luajit=yes], [have_luajit=no])
 CHECK_LUA([have_lua=yes], [have_lua=no])


[50/50] git commit: Merge branch 'master' into 3.3.x

Posted by zw...@apache.org.
Merge branch 'master' into 3.3.x

* master: (64 commits)
  Updated STATUS with v3.3.2 release.
  Add some new generated output files from the RAT checks.
  TS-621 Allow caching of empty docs (currently only if a header Content-Length: 0 is in the response). New config option is named proxy.config.http.cache.allow_empty_doc, and is disabled by default.
  TS-1778: Remove vestigal extensions.config support
  filename_to_string doesn't need to strdup
  Fix ubuntu vagrant image URL
  TS-1806: bogus buffer sizing in CfgContextUtils.cc
  Remove obsolete mgr.cnf config file
  TS-1805: fix uninitialized result_type in NodeStatEval()
  TS-1805: fix conversion when pass value to statVarSet()
  Drop in libloader code.
  Fix vagrant VM addressing
  Turn the vagrant file back into actual ruby
  streamline vagrant network assignments
  TS-1760: clean up and fix --enable-linux-native-aio
  Clean up --enable-luajit help string
  Clean up --enable-reclaimable-freelist help string
  TS-1067 Fix the code around the proxy.config.udp.theads option
  TS-1760: Option to use Linux native AIO
  Teach vagrant that omnios is solaris
  ...


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

Branch: refs/heads/3.3.x
Commit: d64480be9197ae83d1f2701033ca8b4f9cf59d9b
Parents: f591c23 e66b1b6
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Apr 15 15:17:35 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Apr 15 15:17:35 2013 -0600

----------------------------------------------------------------------
 STATUS |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------



[43/50] git commit: Fix ubuntu vagrant image URL

Posted by zw...@apache.org.
Fix ubuntu vagrant image URL


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

Branch: refs/heads/3.3.x
Commit: 116b74ebf6f34d5cc7c4cdae156613d91e7b5089
Parents: 370fba9
Author: James Peach <jp...@apache.org>
Authored: Wed Apr 10 10:47:11 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed Apr 10 10:47:11 2013 -0700

----------------------------------------------------------------------
 Vagrantfile                 |    2 +-
 contrib/manifests/debian.pp |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/116b74eb/Vagrantfile
----------------------------------------------------------------------
diff --git a/Vagrantfile b/Vagrantfile
index 87dd26e..064b3b4 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -42,7 +42,7 @@ Vagrant.configure("2") do |config|
   ['raring', 'quantal', 'precise'].each { |release|
     config.vm.define "#{release}64" do | config |
       config.vm.box = "#{release}64"
-      config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/%{release}/current/#{release}-server-cloudimg-amd64-vagrant-disk1.box"
+      config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/#{release}/current/#{release}-server-cloudimg-amd64-vagrant-disk1.box"
       config.vm.network :private_network, ip: $network["#{release}64"]
       config.vm.provision :puppet do |puppet|
         puppet.manifests_path = "contrib/manifests"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/116b74eb/contrib/manifests/debian.pp
----------------------------------------------------------------------
diff --git a/contrib/manifests/debian.pp b/contrib/manifests/debian.pp
index d495226..db5873e 100644
--- a/contrib/manifests/debian.pp
+++ b/contrib/manifests/debian.pp
@@ -16,7 +16,7 @@
 
 # Base ATS build dependencies.
 package {[
-    'gcc', 'g++', 'automake', 'autoconf', 'libtool',
+    'gcc', 'g++', 'automake', 'autoconf', 'libtool', 'pkg-config',
     'libssl-dev', 'tcl-dev', 'libexpat1-dev', 'libpcre3-dev',
     'libcap-dev', 'libcap2', 'bison', 'flex', 'make',
   ]:


[19/50] git commit: TS-1067 Add a new config option, proxy.config.ssl.number.threads, and code

Posted by zw...@apache.org.
TS-1067 Add a new config option, proxy.config.ssl.number.threads, and code


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

Branch: refs/heads/3.3.x
Commit: bfc78c736da2336fc05b83faab2a4381229b6e21
Parents: a544466
Author: Leif Hedstrom <zw...@apache.org>
Authored: Wed Mar 27 12:08:43 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:53:42 2013 -0600

----------------------------------------------------------------------
 mgmt/RecordsConfig.cc |    2 ++
 proxy/Main.cc         |   23 +++++++++++++----------
 2 files changed, 15 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bfc78c73/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 6926a40..bf9e56a 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -281,6 +281,8 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_CONFIG, "proxy.config.udp.send_retries", RECD_INT, "0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.udp.threads", RECD_INT, "0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
 
   //##############################################################################
   //#

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bfc78c73/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index addbeeb..05c3bc4 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -97,11 +97,6 @@ extern "C" int plock(int);
 //
 // Global Data
 //
-#define DEFAULT_NUMBER_OF_THREADS         ink_number_of_processors()
-#define DEFAULT_NUMBER_OF_UDP_THREADS     1
-#define DEFAULT_NUMBER_OF_SSL_THREADS     0
-#define DEFAULT_NUM_ACCEPT_THREADS        0
-#define DEFAULT_NUM_TASK_THREADS          0
 #define DEFAULT_HTTP_ACCEPT_PORT_NUMBER   0
 #define DEFAULT_COMMAND_FLAG              0
 #define DEFAULT_LOCK_PROCESS              0
@@ -123,11 +118,13 @@ static void * mgmt_restart_shutdown_callback(void *, char *, int data_len);
 static int version_flag = DEFAULT_VERSION_FLAG;
 
 static int const number_of_processors = ink_number_of_processors();
-static int num_of_net_threads = DEFAULT_NUMBER_OF_THREADS;
+static int num_of_net_threads = number_of_processors;
+static int num_of_udp_threads = 0;
+static int num_accept_threads  = 0;
+static int num_task_threads = 0;
+
 extern int num_of_cluster_threads;
-static int num_of_udp_threads = DEFAULT_NUMBER_OF_UDP_THREADS;
-static int num_accept_threads  = DEFAULT_NUM_ACCEPT_THREADS;
-static int num_task_threads = DEFAULT_NUM_TASK_THREADS;
+
 #if TS_HAS_TESTS
 static int run_test_hook = 0;
 #endif
@@ -1639,7 +1636,13 @@ main(int argc, char **argv)
     HttpProxyPort::loadDefaultIfEmpty();
 
     cacheProcessor.start();
-    udpNet.start(num_of_udp_threads);
+
+    // UDP net-threads are turned off by default.
+    if (!num_of_udp_threads)
+      TS_ReadConfigInteger(num_of_udp_threads, "proxy.config.ssl.number.threads");
+    if (num_of_udp_threads)
+      udpNet.start(num_of_udp_threads);
+
     sslNetProcessor.start(getNumSSLThreads());
 
 #ifndef INK_NO_LOG


[08/50] git commit: TS-1067 Remove the bandwidth_mgmt config file, and corresponding parser code

Posted by zw...@apache.org.
TS-1067 Remove the bandwidth_mgmt config file, and corresponding parser code


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

Branch: refs/heads/3.3.x
Commit: 435e14e02187245045bab15c24cb85b1049cc652
Parents: 82ce5ff
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 08:22:02 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:52:32 2013 -0600

----------------------------------------------------------------------
 mgmt/RecordsConfig.cc |    8 ----
 proxy/Main.cc         |   96 +++-----------------------------------------
 2 files changed, 6 insertions(+), 98 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/435e14e0/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 9bdad55..6926a40 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -284,14 +284,6 @@ RecordElement RecordsConfig[] = {
 
   //##############################################################################
   //#
-  //# Bandwith Management file
-  //#
-  //##############################################################################
-  {RECT_CONFIG, "proxy.config.bandwidth_mgmt.filename", RECD_STRING, "bandwidth_mgmt_xml.config", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
-  ,
-
-  //##############################################################################
-  //#
   //# Process Manager
   //#
   //##############################################################################

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/435e14e0/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 9271770..5337748 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -119,7 +119,6 @@ extern "C" int plock(int);
 #define DEFAULT_REMOTE_MANAGEMENT_FLAG    0
 
 static void * mgmt_restart_shutdown_callback(void *, char *, int data_len);
-static bool xmlBandwidthSchemaRead(XMLNode * node);
 
 static int version_flag = DEFAULT_VERSION_FLAG;
 
@@ -1522,27 +1521,17 @@ main(int argc, char **argv)
   TS_ReadConfigInteger(history_info_enabled, "proxy.config.history_info_enabled");
   TS_ReadConfigInteger(res_track_memory, "proxy.config.res_track_memory");
 
-  {
-    XMLDom schema;
-    //char *configPath = TS_ConfigReadString("proxy.config.config_dir");
-    char *filename = TS_ConfigReadString("proxy.config.bandwidth_mgmt.filename");
-    char bwFilename[PATH_NAME_MAX];
-
-    snprintf(bwFilename, sizeof(bwFilename), "%s/%s", system_config_directory, filename);
-    ats_free(filename);
-
-    Debug("bw-mgmt", "Looking to read: %s for bw-mgmt", bwFilename);
-    schema.LoadFile(bwFilename);
-    xmlBandwidthSchemaRead(&schema);
-  }
-
+  // This was the default when we had no bandwidth_mgmt.filename to load
+  // but I don't know for sure if we still need this.
+  G_inkPipeInfo.perPipeInfo = NEW(new InkSinglePipeInfo[1]);
+  G_inkPipeInfo.perPipeInfo[0].wt = 1.0;
+  G_inkPipeInfo.numPipes = 0;
+  G_inkPipeInfo.interfaceMbps = 0.0;
 
   init_http_header();
 
   // Sanity checks
-  //  if (!lock_process) check_for_root_uid();
   check_fd_limit();
-
   command_flag = command_flag || *command_string;
 
   // Set up store
@@ -1789,79 +1778,6 @@ main(int argc, char **argv)
 }
 
 
-static bool
-xmlBandwidthSchemaRead(XMLNode * node)
-{
-  XMLNode *child, *c2;
-  int i, j, k;
-  unsigned char *p;
-  char *ip;
-
-  // file doesn't exist
-  if (node->getNodeName() == NULL) {
-    // alloc 1-elt array to store stuff for best-effort traffic
-    G_inkPipeInfo.perPipeInfo = NEW(new InkSinglePipeInfo[1]);
-    G_inkPipeInfo.perPipeInfo[0].wt = 1.0;
-    G_inkPipeInfo.numPipes = 0;
-    G_inkPipeInfo.interfaceMbps = 0.0;
-    return true;
-  }
-
-  if (strcmp(node->getNodeName(), "interface") != 0) {
-    Debug("bw-mgmt", "Root node should be an interface tag!\n");
-    return false;
-  }
-  // First entry G_inkPipeInfo.perPipeInfo[0] is the one for "best-effort" traffic.
-  G_inkPipeInfo.perPipeInfo = NEW(new InkSinglePipeInfo[node->getChildCount() + 1]);
-  G_inkPipeInfo.perPipeInfo[0].wt = 1.0;
-  G_inkPipeInfo.numPipes = 0;
-  G_inkPipeInfo.reliabilityMbps = 1.0;
-  G_inkPipeInfo.interfaceMbps = 30.0;
-  for (i = 0; i < node->getChildCount(); i++) {
-    if ((child = node->getChildNode(i))) {
-      if (strcmp(child->getNodeName(), "pipe") == 0) {
-        G_inkPipeInfo.numPipes++;
-        for (k = 0; k < child->getChildCount(); k++) {
-          c2 = child->getChildNode(k);
-          for (int l = 0; l < c2->m_nACount; l++) {
-            if (strcmp(c2->m_pAList[l].pAName, "weight") == 0) {
-              G_inkPipeInfo.perPipeInfo[G_inkPipeInfo.numPipes].wt = atof(c2->m_pAList[l].pAValue);
-              G_inkPipeInfo.perPipeInfo[0].wt -= G_inkPipeInfo.perPipeInfo[G_inkPipeInfo.numPipes].wt;
-            } else if (strcmp(c2->m_pAList[l].pAName, "dest_ip") == 0) {
-              p = (unsigned char *) &(G_inkPipeInfo.perPipeInfo[G_inkPipeInfo.numPipes].destIP);
-              ip = c2->m_pAList[l].pAValue;
-              for (j = 0; j < 4; j++) {
-                p[j] = atoi(ip);
-                while (ip && *ip && (*ip != '.'))
-                  ip++;
-                ip++;
-              }
-            }
-          }
-        }
-      } else if (strcmp(child->getNodeName(), "bandwidth") == 0) {
-        for (j = 0; j < child->m_nACount; j++) {
-          if (strcmp(child->m_pAList[j].pAName, "limit_mbps") == 0) {
-            G_inkPipeInfo.interfaceMbps = atof(child->m_pAList[j].pAValue);
-          } else if (strcmp(child->m_pAList[j].pAName, "reliability_mbps") == 0) {
-            G_inkPipeInfo.reliabilityMbps = atof(child->m_pAList[j].pAValue);
-          }
-        }
-      }
-    }
-  }
-  Debug("bw-mgmt", "Read in: limit_mbps = %lf\n", G_inkPipeInfo.interfaceMbps);
-  for (i = 0; i < G_inkPipeInfo.numPipes + 1; i++) {
-    G_inkPipeInfo.perPipeInfo[i].bwLimit =
-      (int64_t) (G_inkPipeInfo.perPipeInfo[i].wt * G_inkPipeInfo.interfaceMbps * 1024.0 * 1024.0);
-    p = (unsigned char *) &(G_inkPipeInfo.perPipeInfo[i].destIP);
-    Debug("bw-mgmt", "Pipe [%d]: wt = %lf, dest ip = %d.%d.%d.%d\n",
-          i, G_inkPipeInfo.perPipeInfo[i].wt, p[0], p[1], p[2], p[3]);
-  }
-  return true;
-}
-
-
 #if TS_HAS_TESTS
 //////////////////////////////
 // Unit Regresion Test Hook //


[45/50] git commit: TS-1778: Remove vestigal extensions.config support

Posted by zw...@apache.org.
TS-1778: Remove vestigal extensions.config support


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

Branch: refs/heads/3.3.x
Commit: 80d1f32e8e110238048e7ee1e15bf959c7491e8f
Parents: 9ff7592
Author: James Peach <jp...@apache.org>
Authored: Fri Mar 29 14:09:24 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Thu Apr 11 13:40:31 2013 -0700

----------------------------------------------------------------------
 CHANGES                                            |    2 +
 .../perl/AdminClient/lib/Apache/TS/AdminClient.pm  |    1 -
 example/app-template/app-template.cc               |    6 +-
 mgmt/RecordsConfig.cc                              |    2 -
 proxy/Main.cc                                      |    6 +-
 proxy/Makefile.am                                  |    3 -
 proxy/Plugin.cc                                    |   64 +----
 proxy/Plugin.h                                     |    2 +-
 proxy/PluginDB.cc                                  |  205 ---------------
 proxy/PluginDB.h                                   |   65 -----
 10 files changed, 14 insertions(+), 342 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80d1f32e/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 59a196b..3444721 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-1778] Remove vestigal extensions.config support
+
   *) [TS-1806] bogus buffer sizing in CfgContextUtils.cc
 
   *) [TS-1805] Fix stats ExpressionEval in stats xml.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80d1f32e/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm
----------------------------------------------------------------------
diff --git a/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm b/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm
index 82968db..8260fa2 100644
--- a/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm
+++ b/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm
@@ -618,7 +618,6 @@ The Apache Traffic Server Administration Manual will explain what these strings
  proxy.config.output.logfile
  proxy.config.ping.npacks_to_trans
  proxy.config.ping.timeout_sec
- proxy.config.plugin.extensions_dir
  proxy.config.plugin.plugin_dir
  proxy.config.plugin.plugin_mgmt_dir
  proxy.config.prefetch.child_port

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80d1f32e/example/app-template/app-template.cc
----------------------------------------------------------------------
diff --git a/example/app-template/app-template.cc b/example/app-template/app-template.cc
index adc2ef3..737e20a 100644
--- a/example/app-template/app-template.cc
+++ b/example/app-template/app-template.cc
@@ -233,12 +233,8 @@ int main(int argc, char * argv[])
   // initialize logging (after event and net processor)
   //Log::init(system_remote_management_flag ? 0 : Log::NO_REMOTE_MANAGEMENT);
 
-#if !defined(TS_NO_API)
-  //plugin_init(system_config_directory, true); // extensions.config
-#endif
-
 #ifndef TS_NO_API
-  //plugin_init(system_config_directory, false); // plugin.config
+  //plugin_init(system_config_directory); // plugin.config
 #else
   //api_init();  // still need to initialize some of the data structure other module needs.
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80d1f32e/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 75464bf..55b0cb8 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1384,8 +1384,6 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_CONFIG, "proxy.config.plugin.plugin_mgmt_dir", RECD_STRING, TS_BUILD_SYSCONFDIR "/plugins_mgmt", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.plugin.extensions_dir", RECD_STRING, TS_BUILD_RUNTIMEDIR, RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
-  ,
 
   //##############################################################################
   //#

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80d1f32e/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 9cff6f3..c15529c 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -1650,10 +1650,6 @@ main(int argc, char **argv)
     Log::init(remote_management_flag ? 0 : Log::NO_REMOTE_MANAGEMENT);
 #endif
 
-#if !defined(TS_NO_API)
-    plugin_init(system_config_directory, true); // extensions.config
-#endif
-
     //acc.init();
     //if (auto_clear_authdb_flag)
      // acc.clear_cache();
@@ -1717,7 +1713,7 @@ main(int argc, char **argv)
     }
 
 #ifndef TS_NO_API
-    plugin_init(system_config_directory, false);        // plugin.config
+    plugin_init(system_config_directory);        // plugin.config
 #else
     api_init();                 // we still need to initialize some of the data structure other module needs.
     // i.e. http_global_hooks

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80d1f32e/proxy/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index ff2529d..288261d 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -106,8 +106,6 @@ traffic_server_SOURCES = \
   ParentSelection.h \
   Plugin.cc \
   Plugin.h \
-  PluginDB.cc \
-  PluginDB.h \
   PluginVC.cc \
   PluginVC.h \
   Prefetch.cc \
@@ -233,7 +231,6 @@ traffic_sac_SOURCES = \
   Prefetch.cc \
   Update.cc \
   Plugin.cc \
-  PluginDB.cc \
   InkAPI.cc \
   FetchSM.cc \
   InkIOCoreAPI.cc \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80d1f32e/proxy/Plugin.cc
----------------------------------------------------------------------
diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc
index e40925b..419017b 100644
--- a/proxy/Plugin.cc
+++ b/proxy/Plugin.cc
@@ -35,7 +35,6 @@
 #include "InkAPIInternal.h"
 #include "Main.h"
 #include "Plugin.h"
-#include "PluginDB.h"
 
 // HPUX:
 //   LD_SHAREDCMD=ld -b
@@ -48,12 +47,8 @@
 
 
 static const char *plugin_dir = ".";
-static const char *extensions_dir = ".";
-static PluginDB *plugin_db = NULL;
 
 typedef void (*init_func_t) (int argc, char *argv[]);
-typedef void (*init_func_w_handle_t) (void *handle, int argc, char *argv[]);
-typedef int (*lic_req_func_t) (void);
 
 // Plugin registration vars
 //
@@ -75,11 +70,9 @@ PluginRegInfo::PluginRegInfo()
 { }
 
 static void *
-dll_open(char *fn, bool global)
+dll_open(const char *path)
 {
-  int global_flags = global ? RTLD_GLOBAL : 0;
-
-  return (void *) dlopen(fn, RTLD_NOW | global_flags);
+  return (void *) dlopen(path, RTLD_NOW);
 }
 
 static void *
@@ -101,21 +94,18 @@ dll_close(void *dlp)
   dlclose(dlp);
 }
 
-
 static void
-plugin_load(int argc, char *argv[], bool internal)
+plugin_load(int argc, char *argv[])
 {
   char path[PATH_NAME_MAX + 1];
   void *handle;
   init_func_t init;
-  lic_req_func_t lic_req;
   PluginRegInfo *plugin_reg_temp;
-  const char *pdir = internal ? extensions_dir : plugin_dir;
 
   if (argc < 1) {
     return;
   }
-  ink_filepath_make(path, sizeof(path), pdir, argv[0]);
+  ink_filepath_make(path, sizeof(path), plugin_dir, argv[0]);
 
   Note("loading plugin '%s'", path);
 
@@ -128,33 +118,18 @@ plugin_load(int argc, char *argv[], bool internal)
     plugin_reg_temp = (plugin_reg_temp->link).next;
   }
 
-  handle = dll_open(path, (internal ? true : false));
+  handle = dll_open(path);
   if (!handle) {
     Error("unable to load '%s': %s", path, dll_error(handle));
     abort();
   }
 
-  lic_req = (lic_req_func_t) dll_findsym(handle, "TSPluginLicenseRequired");
-  if (lic_req && lic_req() != 0) {
-    PluginDB::CheckLicenseResult result = plugin_db->CheckLicense(argv[0]);
-    if (result != PluginDB::license_ok) {
-      Error("unable to load '%s': %s", path, PluginDB::CheckLicenseResultStr[result]);
-      dll_close(handle);
-      abort();
-    }
-  }
   // Allocate a new registration structure for the
   //    plugin we're starting up
   ink_assert(plugin_reg_current == NULL);
   plugin_reg_current = new PluginRegInfo;
   plugin_reg_current->plugin_path = ats_strdup(path);
 
-  init_func_w_handle_t inith = (init_func_w_handle_t) dll_findsym(handle, "TSPluginInitwDLLHandle");
-  if (inith) {
-    inith(handle, argc, argv);
-    return;
-  }
-
   init = (init_func_t) dll_findsym(handle, "TSPluginInit");
   if (!init) {
     Error("unable to find TSPluginInit function '%s': %s", path, dll_error(handle));
@@ -268,7 +243,7 @@ plugins_exist(const char *config_dir)
 }
 
 void
-plugin_init(const char *config_dir, bool internal)
+plugin_init(const char *config_dir)
 {
   char path[PATH_NAME_MAX + 1];
   char line[1024], *p;
@@ -281,35 +256,14 @@ plugin_init(const char *config_dir, bool internal)
 
   if (INIT_ONCE) {
     api_init();
-    char *cfg = NULL;
-
     plugin_dir = TSPluginDirGet();
-
-    RecGetRecordString_Xmalloc("proxy.config.plugin.extensions_dir", (char**)&cfg);
-    if (cfg != NULL) {
-      extensions_dir = Layout::get()->relative(cfg);
-      ats_free(cfg);
-      cfg = NULL;
-    }
-    ink_filepath_make(path, sizeof(path), config_dir, "plugin.db");
-    plugin_db = new PluginDB(path);
     INIT_ONCE = false;
   }
 
-  ink_assert(plugin_db);
-
-  if (internal == false) {
-    ink_filepath_make(path, sizeof(path), config_dir, "plugin.config");
-  } else {
-    ink_filepath_make(path, sizeof(path), config_dir, "extensions.config");
-  }
-
+  ink_filepath_make(path, sizeof(path), config_dir, "plugin.config");
   fd = open(path, O_RDONLY);
   if (fd < 0) {
-    /* secret extensions dont complain */
-    if (internal == false) {
-      Warning("unable to open plugin config file '%s': %d, %s", path, errno, strerror(errno));
-    }
+    Warning("unable to open plugin config file '%s': %d, %s", path, errno, strerror(errno));
     return;
   }
 
@@ -362,7 +316,7 @@ plugin_init(const char *config_dir, bool internal)
       }
     }
 
-    plugin_load(argc, argv, internal);
+    plugin_load(argc, argv);
 
     for (i = 0; i < argc; i++)
       ats_free(vars[i]);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80d1f32e/proxy/Plugin.h
----------------------------------------------------------------------
diff --git a/proxy/Plugin.h b/proxy/Plugin.h
index d520313..4173a05 100644
--- a/proxy/Plugin.h
+++ b/proxy/Plugin.h
@@ -56,7 +56,7 @@ struct PluginRegInfo
 extern DLL<PluginRegInfo> plugin_reg_list;
 extern PluginRegInfo *plugin_reg_current;
 
-void plugin_init(const char *config_dir, bool internal_exts);
+void plugin_init(const char *config_dir);
 int plugins_exist(const char *config_dir);
 
 #endif /* __PLUGIN_H__ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80d1f32e/proxy/PluginDB.cc
----------------------------------------------------------------------
diff --git a/proxy/PluginDB.cc b/proxy/PluginDB.cc
deleted file mode 100644
index a2b42d2..0000000
--- a/proxy/PluginDB.cc
+++ /dev/null
@@ -1,205 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include "ink_config.h"
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include "ink_code.h"
-#include "Diags.h"
-#include "ParseRules.h"
-#include "PluginDB.h"
-
-/***************************************************************************
- *
- * An Inktomi Traffic Server plugin license key should look like:
- *
- *     XXXXXEEEEDDDDDD
- *
- * XXXXX is a 5 digit alphanumeric id used by plugin vendors to
- * assign to their customers.
- *
- * EEEE is the hex encoding of the expiration date. It's the number
- * of days from January 1, 1970. If a plugin has no expiration date,
- * 0000 can be used instead.
- *
- * DDDDDD is the INK_MD5 encoding of some combination of the following
- * strings: "Inktomi Traffic Server", "Plugin Name", "XXXXXEEEE".
- *
- *
- ***************************************************************************/
-
-const char *
-  PluginDB::CheckLicenseResultStr[] = {
-  "license missing",
-  "license expired",
-  "license invalid",
-  "license ok"
-};
-
-const unsigned int
-  PluginDB::license_custid_len = 5;
-const unsigned int
-  PluginDB::license_expire_len = 4;
-const unsigned int
-  PluginDB::license_digest_len = 6;
-const unsigned int
-  PluginDB::license_total_len = PluginDB::license_custid_len +
-  PluginDB::license_expire_len + PluginDB::license_digest_len;
-
-PluginDB::PluginDB(const char *plugin_db_file)
-{
-  info_table = ink_hash_table_create(InkHashTableKeyType_String);
-  ReadPluginDB(plugin_db_file);
-}
-
-PluginDB::~PluginDB(void)
-{
-  ink_hash_table_destroy_and_free_values(info_table);
-}
-
-void
-PluginDB::ReadPluginDB(const char *plugin_db_file)
-{
-  FILE *pdb = fopen(plugin_db_file, "r");
-  if (pdb == NULL) {
-    Warning("unable to open plugin.db file '%s': %d, %s", plugin_db_file, errno, strerror(errno));
-    return;
-  }
-
-  char line[1024];
-  char plugin_obj[256];
-  plugin_obj[0] = '\0';
-  PluginDB::PluginInfo * pinfo = new PluginDB::PluginInfo();
-
-  while (fgets(line, sizeof(line) - 1, pdb) != NULL) {
-    char *p = line;
-    while (*p && ParseRules::is_wslfcr(*p)) {
-      p++;
-    }
-    if ((*p == '\0') || (*p == '#')) {
-      continue;
-    }
-    // We have a non-comment and non-blank line
-
-    // Nullify the newline character
-    int len = strlen(p);
-    int i;
-    p[len - 1] = '\0';
-
-    if (p[0] == '[') {
-      if (plugin_obj[0] != '\0' && (pinfo->name[0] != '\0' || pinfo->license[0] != '\0')) {
-        ink_hash_table_insert(info_table, (InkHashTableKey) plugin_obj, (InkHashTableValue) pinfo);
-        plugin_obj[0] = '\0';
-        pinfo = new PluginDB::PluginInfo();
-      }
-      p++;
-      for (i = 0; p[i] != '\0' && p[i] != ']' && i < 255; i++) {
-        pinfo->name[i] = p[i];
-      }
-      pinfo->name[i] = '\0';
-
-    } else {
-      if (strstr(p, "Object=")) {
-        p = p + sizeof("Object=") - 1;
-        for (i = 0; p[i] != '\0' && i < 255; i++) {
-          plugin_obj[i] = p[i];
-        }
-        plugin_obj[i] = '\0';
-      } else if (strstr(p, "License=")) {
-        p = p + sizeof("License=") - 1;
-        for (i = 0; p[i] != '\0' && i < 255; i++) {
-          pinfo->license[i] = p[i];
-        }
-        pinfo->license[i] = '\0';
-      }
-    }
-  }
-
-  if (plugin_obj[0] != '\0' && (pinfo->name[0] != '\0' || pinfo->license[0] != '\0')) {
-    ink_hash_table_insert(info_table, (InkHashTableKey) plugin_obj, (InkHashTableValue) pinfo);
-  } else {
-    delete pinfo;
-  }
-  fclose(pdb);
-}
-
-PluginDB::CheckLicenseResult PluginDB::CheckLicense(const char *plugin_obj)
-{
-  char
-    buffer[1024],
-    buffer_md5[16],
-    buffer_md5_str[33];
-  char
-    expire_str[PluginDB::license_expire_len + 1];
-  unsigned long
-    expire_days;
-  INK_DIGEST_CTX
-    md5_context;
-  PluginDB::PluginInfo * pinfo;
-  char *
-    end_ptr = NULL;
-
-  InkHashTableEntry *
-    ht_entry = ink_hash_table_lookup_entry(info_table,
-                                           (InkHashTableKey) plugin_obj);
-  if (ht_entry != NULL) {
-    pinfo = (PluginDB::PluginInfo *) ink_hash_table_entry_value(info_table, ht_entry);
-  } else {
-    return PluginDB::license_missing;
-  }
-
-  if (strlen(pinfo->license) != PluginDB::license_total_len) {
-    return PluginDB::license_invalid;
-  }
-
-  snprintf(buffer, sizeof(buffer), "Inktomi Traffic Server %s ", pinfo->name);
-  strncat(buffer, pinfo->license, PluginDB::license_custid_len + PluginDB::license_expire_len);
-
-  ink_code_incr_md5_init(&md5_context);
-  ink_code_incr_md5_update(&md5_context, buffer, strlen(buffer));
-  ink_code_incr_md5_final(buffer_md5, &md5_context);
-  // coverity[uninit_use_in_call]
-  ink_code_md5_stringify(buffer_md5_str, sizeof(buffer_md5_str), buffer_md5);
-
-  if (strncmp(buffer_md5_str,
-              pinfo->license + PluginDB::license_custid_len
-              + PluginDB::license_expire_len, PluginDB::license_digest_len) != 0) {
-    return PluginDB::license_invalid;
-  }
-
-  strncpy(expire_str, pinfo->license + PluginDB::license_custid_len, PluginDB::license_expire_len);
-  expire_str[PluginDB::license_expire_len] = '\0';
-
-  expire_days = strtoul(expire_str, &end_ptr, 16);
-
-  if (expire_days != 0) {
-    time_t
-      time_now = time(NULL);
-    if ((unsigned long) time_now > expire_days * (60 * 60 * 24)) {
-      return PluginDB::license_expired;
-    }
-  }
-
-  return PluginDB::license_ok;
-}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80d1f32e/proxy/PluginDB.h
----------------------------------------------------------------------
diff --git a/proxy/PluginDB.h b/proxy/PluginDB.h
deleted file mode 100644
index cf8f3ae..0000000
--- a/proxy/PluginDB.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#ifndef __PLUGIN_DB_H__
-#define __PLUGIN_DB_H__
-
-#include "ink_hash_table.h"
-
-class PluginDB
-{
-public:
-  typedef enum
-  {
-    license_missing = 0,
-    license_expired,
-    license_invalid,
-    license_ok
-  } CheckLicenseResult;
-
-    PluginDB(const char *plugin_db_file);
-   ~PluginDB(void);
-
-  CheckLicenseResult CheckLicense(const char *plugin_obj);
-
-  static const char *CheckLicenseResultStr[];
-
-private:
-
-  typedef struct
-  {
-    char name[256];
-    char license[256];
-  } PluginInfo;
-
-  static const unsigned int license_custid_len;
-  static const unsigned int license_expire_len;
-  static const unsigned int license_digest_len;
-  static const unsigned int license_total_len;
-
-  void ReadPluginDB(const char *plugin_db_file);
-
-  InkHashTable *info_table;
-};
-
-#endif /* __PLUGIN_DB_H__ */


[07/50] git commit: TS-1736: Fatal() terminates process without a backtrace

Posted by zw...@apache.org.
TS-1736: Fatal() terminates process without a backtrace

The root casue is that cleanup_func() was called before logging
backtrace in Diags::error(), however cleanup_func() would terminate
process by calling exit() directly.


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

Branch: refs/heads/3.3.x
Commit: 82ce5ff1919a0c15e44b47dba36967db0acc427b
Parents: 3f905d5
Author: Yunkai Zhang <yu...@gmail.com>
Authored: Tue Apr 2 11:56:30 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Tue Apr 2 11:58:03 2013 -0700

----------------------------------------------------------------------
 CHANGES                    |    5 ++++-
 mgmt/LocalManager.cc       |    6 ++----
 mgmt/LocalManager.h        |    2 +-
 mgmt/Main.cc               |    3 ++-
 mgmt/api/CoreAPI.cc        |    2 +-
 mgmt/cluster/ClusterCom.cc |    4 ++--
 mgmt/utils/MgmtUtils.cc    |    2 +-
 7 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/82ce5ff1/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 9883ad7..04d63ad 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,9 +2,12 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-1736] Fatal() terminates process without a backtrace
+    Author: Yunkai Zhang <yu...@gmail.com>
+
   *) [TS-1791] remove m_mutex acquire&release to avoid deadlock in
    ~LogBufferList(). Author: Gang Li <qu...@taobao.com>.
-   
+
   *) [TS-1713] SRV support refine. Now the srv option is able to enable, with
    no crash. Be care, the hostdb.storage_size or ostdb.size need check.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/82ce5ff1/mgmt/LocalManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index 20a711d..aaddf18 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -62,7 +62,7 @@ LocalManager::mgmtCleanup()
 
 
 void
-LocalManager::mgmtShutdown(int status, bool mainThread)
+LocalManager::mgmtShutdown(bool mainThread)
 {
   if (mainThread) {
     mgmt_log("[LocalManager::mgmtShutdown] Executing shutdown request.\n");
@@ -70,7 +70,7 @@ LocalManager::mgmtShutdown(int status, bool mainThread)
     // WCCP TBD: Send a shutdown message to routers.
 
     if (processRunning()) {
-      waitpid(watched_process_pid, &status, 0);
+      waitpid(watched_process_pid, NULL, 0);
 #if defined(linux)
       /* Avert race condition, wait for the thread to complete,
          before getting one more restart process */
@@ -78,9 +78,7 @@ LocalManager::mgmtShutdown(int status, bool mainThread)
       mgmt_sleep_msec(1);
 #endif
     }
-
     mgmtCleanup();
-    _exit(status);
   } else {
     mgmt_shutdown_outstanding = true;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/82ce5ff1/mgmt/LocalManager.h
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.h b/mgmt/LocalManager.h
index 92e7d65..8df0640 100644
--- a/mgmt/LocalManager.h
+++ b/mgmt/LocalManager.h
@@ -87,7 +87,7 @@ public:
   void closeProxyPorts();
 
   void mgmtCleanup();
-  void mgmtShutdown(int status, bool mainThread = false);
+  void mgmtShutdown(bool mainThread = false);
   void processShutdown(bool mainThread = false);
   void processRestart();
   void processBounce();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/82ce5ff1/mgmt/Main.cc
----------------------------------------------------------------------
diff --git a/mgmt/Main.cc b/mgmt/Main.cc
index 2463689..3760366 100644
--- a/mgmt/Main.cc
+++ b/mgmt/Main.cc
@@ -798,7 +798,8 @@ main(int argc, char **argv)
     }
 
     if (lmgmt->mgmt_shutdown_outstanding == true) {
-      lmgmt->mgmtShutdown(0, true);
+      lmgmt->mgmtShutdown(true);
+      _exit(0);
     }
 
     if (lmgmt->run_proxy && !lmgmt->processRunning()) { /* Make sure we still have a proxy up */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/82ce5ff1/mgmt/api/CoreAPI.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc
index 43c5f30..c5a1a21 100644
--- a/mgmt/api/CoreAPI.cc
+++ b/mgmt/api/CoreAPI.cc
@@ -256,7 +256,7 @@ Restart(bool cluster)
     // this will kill TM completely;traffic_cop will restart TM/TS
     lmgmt->ccom->sendClusterMessage(CLUSTER_MSG_SHUTDOWN_MANAGER);
   } else {                      // just bounce local proxy
-    lmgmt->mgmtShutdown(0);
+    lmgmt->mgmtShutdown();
   }
 
   return TS_ERR_OKAY;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/82ce5ff1/mgmt/cluster/ClusterCom.cc
----------------------------------------------------------------------
diff --git a/mgmt/cluster/ClusterCom.cc b/mgmt/cluster/ClusterCom.cc
index 4a40c24..6f15a91 100644
--- a/mgmt/cluster/ClusterCom.cc
+++ b/mgmt/cluster/ClusterCom.cc
@@ -273,7 +273,7 @@ drainIncomingChannel(void *arg)
             delete buff;
         } else if (strstr(message, "cmd: shutdown_manager")) {
           mgmt_log("[ClusterCom::drainIncomingChannel] Received manager shutdown request\n");
-          lmgmt->mgmtShutdown(0);
+          lmgmt->mgmtShutdown();
         } else if (strstr(message, "cmd: shutdown_process")) {
           mgmt_log("[ClusterCom::drainIncomingChannel] Received process shutdown request\n");
           lmgmt->processShutdown();
@@ -1789,7 +1789,7 @@ ClusterCom::sendClusterMessage(int msg_type, const char *args)
 
   switch (msg_type) {
   case CLUSTER_MSG_SHUTDOWN_MANAGER:
-    lmgmt->mgmtShutdown(0);
+    lmgmt->mgmtShutdown();
     break;
   case CLUSTER_MSG_SHUTDOWN_PROCESS:
     lmgmt->processShutdown();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/82ce5ff1/mgmt/utils/MgmtUtils.cc
----------------------------------------------------------------------
diff --git a/mgmt/utils/MgmtUtils.cc b/mgmt/utils/MgmtUtils.cc
index 6a5c40e..29d4401 100644
--- a/mgmt/utils/MgmtUtils.cc
+++ b/mgmt/utils/MgmtUtils.cc
@@ -473,7 +473,7 @@ mgmt_cleanup()
 {
 #if defined(LOCAL_MANAGER)
   if (lmgmt != NULL) {
-    lmgmt->mgmtShutdown(1, true);
+    lmgmt->mgmtShutdown(true);
   }
 #endif
 }


[46/50] git commit: TS-621 Allow caching of empty docs (currently only if a header Content-Length: 0 is in the response). New config option is named proxy.config.http.cache.allow_empty_doc, and is disabled by default.

Posted by zw...@apache.org.
TS-621 Allow caching of empty docs (currently only if a header
Content-Length: 0 is in the response). New config option is named
proxy.config.http.cache.allow_empty_doc, and is disabled by default.

We are aware this doesn't fully fix the problem, but is "good enough"
for now.

Reviews and minor cosmetic cleanup changes: James and Leif.


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

Branch: refs/heads/3.3.x
Commit: e2aff41f8d68144a0e90b1412c6006b784769af4
Parents: 80d1f32
Author: weijin <ta...@taobao.com>
Authored: Fri Apr 12 15:23:46 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Apr 12 15:23:46 2013 -0600

----------------------------------------------------------------------
 CHANGES                                |    4 ++++
 iocore/cache/Cache.cc                  |   12 ++++++++++++
 iocore/cache/CacheWrite.cc             |   20 ++++++++++++++++----
 iocore/cache/P_CacheInternal.h         |    3 +++
 iocore/cache/P_CacheVol.h              |    2 +-
 mgmt/RecordsConfig.cc                  |    4 ++++
 proxy/config/records.config.default.in |    3 +++
 7 files changed, 43 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e2aff41f/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 3444721..dd1dcb5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-621] Allow caching of empty docs (currently only if a header
+   Content-Length: 0 is in the response). New config option is named
+   proxy.config.http.cache.allow_empty_doc, and is disabled by default.
+
   *) [TS-1778] Remove vestigal extensions.config support
 
   *) [TS-1806] bogus buffer sizing in CfgContextUtils.cc

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e2aff41f/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index d5ba29f..319aca3 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -79,6 +79,9 @@ int cache_config_alt_rewrite_max_size = 4096;
 int cache_config_read_while_writer = 0;
 char cache_system_config_directory[PATH_NAME_MAX + 1];
 int cache_config_mutex_retry_delay = 2;
+#ifdef HTTP_CACHE
+static int enable_cache_empty_http_doc = 0;
+#endif
 
 // Globals
 
@@ -458,6 +461,14 @@ CacheVC::set_http_info(CacheHTTPInfo *ainfo)
     ainfo->object_key_set(earliest_key);
     // don't know the total len yet
   }
+  if (enable_cache_empty_http_doc) {
+    MIMEField *field = ainfo->m_alt->m_response_hdr.field_find(MIME_FIELD_CONTENT_LENGTH, MIME_LEN_CONTENT_LENGTH);
+    if (field && !field->value_get_int64()) 
+      f.allow_empty_doc = 1;
+    else
+      f.allow_empty_doc = 0;
+  } else 
+    f.allow_empty_doc = 0;
   alternate.copy_shallow(ainfo);
   ainfo->clear();
 }
@@ -2819,6 +2830,7 @@ ink_cache_init(ModuleVersion v)
   //  # 1 - MMH hash
   REC_EstablishStaticConfigInt32(url_hash_method, "proxy.config.cache.url_hash_method");
   Debug("cache_init", "proxy.config.cache.url_hash_method = %d", url_hash_method);
+  REC_EstablishStaticConfigInt32(enable_cache_empty_http_doc, "proxy.config.http.cache.allow_empty_doc");
 #endif
 
   REC_EstablishStaticConfigInt32(cache_config_max_disk_errors, "proxy.config.cache.max_disk_errors");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e2aff41f/iocore/cache/CacheWrite.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index b93839d..5160eff 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -779,7 +779,11 @@ agg_copy(char *p, CacheVC *vc)
     }
 
     if (vc->f.use_first_key) {
-      if (doc->data_len())
+      if (doc->data_len()
+#ifdef HTTP_CACHE
+                  || vc->f.allow_empty_doc
+#endif
+                  )
         doc->key = vc->earliest_key;
       else // the vector is being written by itself
         prev_CacheKey(&doc->key, &vc->earliest_key);
@@ -1122,7 +1126,11 @@ CacheVC::openWriteCloseDir(int event, Event *e)
   // one, two and three or more fragments. This is because for
   // updates we dont decrement the variable corresponding the old
   // size of the document
-  if ((closed == 1) && (total_len > 0)) {
+  if ((closed == 1) && (total_len > 0
+#ifdef HTTP_CACHE
+                  || f.allow_empty_doc
+#endif
+                  )) {
     DDebug("cache_stats", "Fragment = %d", fragment);
     switch (fragment) {
       case 0: CACHE_INCREMENT_DYN_STAT(cache_single_fragment_document_count_stat); break;
@@ -1270,10 +1278,14 @@ CacheVC::openWriteClose(int event, Event *e)
     if (!io.ok())
       return openWriteCloseDir(event, e);
   }
-  if (closed > 0) {
+  if (closed > 0
+#ifdef HTTP_CACHE
+                  || f.allow_empty_doc
+#endif
+                  ) {
     if (total_len == 0) {
 #ifdef HTTP_CACHE
-      if (f.update) {
+      if (f.update || f.allow_empty_doc) {
         return updateVector(event, e);
       } else {
         // If we've been CLOSE'd but nothing has been written then

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e2aff41f/iocore/cache/P_CacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index b65cb65..634a1bc 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -485,6 +485,9 @@ struct CacheVC: public CacheVConnection
 #ifdef HIT_EVACUATE
       unsigned int hit_evacuate:1;
 #endif
+#ifdef HTTP_CACHE
+      unsigned int allow_empty_doc:1; // used for cache empty http document
+#endif
     } f;
   };
   // BTF optimization used to skip reading stuff in cache partition that doesn't contain any

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e2aff41f/iocore/cache/P_CacheVol.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheVol.h b/iocore/cache/P_CacheVol.h
index dc183a7..4df3f0f 100644
--- a/iocore/cache/P_CacheVol.h
+++ b/iocore/cache/P_CacheVol.h
@@ -423,7 +423,7 @@ Doc::data_len()
 TS_INLINE int
 Doc::single_fragment()
 {
-  return (total_len && (data_len() == total_len));
+  return (data_len() == total_len);
 }
 
 TS_INLINE char *

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e2aff41f/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 55b0cb8..3185e2c 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -629,6 +629,10 @@ RecordElement RecordsConfig[] = {
   //        #################
   {RECT_CONFIG, "proxy.config.http.cache.http", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
   ,
+  // Enabling this setting allows the proxy to cache empty documents. This currently requires
+  // that the response has a Content-Length: header, with a value of "0".
+  {RECT_CONFIG, "proxy.config.http.cache.allow_empty_doc", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, "[0-1]", RECA_NULL }
+  ,
   {RECT_CONFIG, "proxy.config.http.cache.cluster_cache_local", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.http.cache.ignore_client_no_cache", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e2aff41f/proxy/config/records.config.default.in
----------------------------------------------------------------------
diff --git a/proxy/config/records.config.default.in b/proxy/config/records.config.default.in
index 9e396f0..7b39d07 100644
--- a/proxy/config/records.config.default.in
+++ b/proxy/config/records.config.default.in
@@ -218,6 +218,9 @@ CONFIG proxy.config.http.push_method_enabled INT 0
    # cache control #
    #################
 CONFIG proxy.config.http.cache.http INT 1
+   # Enabling this setting allows the proxy to cache empty documents. This currently
+   # requires that the response has a Content-Length: header, with a value of "0".
+CONFIG proxy.config.http.cache.allow_empty_doc INT 0
 CONFIG proxy.config.http.cache.ignore_client_no_cache INT 1
 CONFIG proxy.config.http.cache.ims_on_client_no_cache INT 1
 CONFIG proxy.config.http.cache.ignore_server_no_cache INT 0


[26/50] git commit: TS-1783 Remove the remnants of wpad.dat

Posted by zw...@apache.org.
TS-1783 Remove the remnants of wpad.dat


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

Branch: refs/heads/3.3.x
Commit: 8f7f66a77a0bf544bab0930b29d79b8e365cd1d4
Parents: 16a2305
Author: Leif Hedstrom <zw...@apache.org>
Authored: Wed Mar 27 12:29:58 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 17:04:51 2013 -0600

----------------------------------------------------------------------
 .../perl/AdminClient/lib/Apache/TS/AdminClient.pm  |    1 -
 mgmt/AddConfigFilesHere.cc                         |    1 -
 mgmt/Main.cc                                       |    3 ---
 mgmt/RecordsConfig.cc                              |    2 --
 mgmt/web2/WebHttp.cc                               |    1 -
 5 files changed, 0 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8f7f66a7/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm
----------------------------------------------------------------------
diff --git a/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm b/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm
index 1374cf4..82968db 100644
--- a/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm
+++ b/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm
@@ -270,7 +270,6 @@ The Apache Traffic Server Administration Manual will explain what these strings
  proxy.config.admin.autoconf.pac_filename
  proxy.config.admin.autoconf_port
  proxy.config.admin.autoconf.doc_root
- proxy.config.admin.autoconf.wpad_filename
  proxy.config.admin.cli_path
  proxy.config.admin.number_config_bak
  proxy.config.admin.user_id

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8f7f66a7/mgmt/AddConfigFilesHere.cc
----------------------------------------------------------------------
diff --git a/mgmt/AddConfigFilesHere.cc b/mgmt/AddConfigFilesHere.cc
index 95db5c9..a1e60ae 100644
--- a/mgmt/AddConfigFilesHere.cc
+++ b/mgmt/AddConfigFilesHere.cc
@@ -71,7 +71,6 @@ initializeRegistry()
   configFiles->addFile("storage.config", false);
   configFiles->addFile("socks.config", false);
   configFiles->addFile("proxy.pac", false);
-  configFiles->addFile("wpad.dat", false);
   configFiles->addFile("records.config", false);
   configFiles->addFile("vaddrs.config", false);
   configFiles->addFile("cache.config", false);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8f7f66a7/mgmt/Main.cc
----------------------------------------------------------------------
diff --git a/mgmt/Main.cc b/mgmt/Main.cc
index 3760366..06f3e6a 100644
--- a/mgmt/Main.cc
+++ b/mgmt/Main.cc
@@ -1056,9 +1056,6 @@ fileUpdated(char *fname)
   } else if (strcmp(fname, "proxy.pac") == 0) {
     mgmt_log(stderr, "[fileUpdated] proxy.pac file has been modified\n");
 
-  } else if (strcmp(fname, "wpad.dat") == 0) {
-    mgmt_log(stderr, "[fileUpdated] wpad.dat file has been modified\n");
-
   } else if (strcmp(fname, "icp.config") == 0) {
     lmgmt->signalFileChange("proxy.config.icp.icp_configuration");
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8f7f66a7/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index bf9e56a..75464bf 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -259,8 +259,6 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_CONFIG, "proxy.config.admin.autoconf.pac_filename", RECD_STRING, "proxy.pac", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.admin.autoconf.wpad_filename", RECD_STRING, "wpad.dat", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
-  ,
   {RECT_CONFIG, "proxy.config.admin.admin_user", RECD_STRING, "admin", RECU_DYNAMIC, RR_REQUIRED, RECC_STR, ".+", RECA_NO_ACCESS}
   ,
   {RECT_CONFIG, "proxy.config.admin.number_config_bak", RECD_INT, "3", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8f7f66a7/mgmt/web2/WebHttp.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebHttp.cc b/mgmt/web2/WebHttp.cc
index 5b331ab..14c0804 100644
--- a/mgmt/web2/WebHttp.cc
+++ b/mgmt/web2/WebHttp.cc
@@ -480,7 +480,6 @@ WebHttpInit()
   // initialize allow files
   g_autoconf_allow_ht = ink_hash_table_create(InkHashTableKeyType_String);
   ink_hash_table_insert(g_autoconf_allow_ht, "/proxy.pac", NULL);
-  ink_hash_table_insert(g_autoconf_allow_ht, "/wpad.dat", NULL);
   ink_hash_table_insert(g_autoconf_allow_ht, "/public_key.der", NULL);
   ink_hash_table_insert(g_autoconf_allow_ht, "/synthetic.txt", NULL);
 


[04/50] git commit: Add .dirstamp and CRUFT.txt to RAT exclusion list

Posted by zw...@apache.org.
Add .dirstamp and CRUFT.txt to RAT exclusion list


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

Branch: refs/heads/3.3.x
Commit: dce8e49e222b8a601dea94af62348e4ba70d5a79
Parents: 91ba85c
Author: Uri Shachar <us...@apache.org>
Authored: Tue Apr 2 15:34:30 2013 +0300
Committer: Uri Shachar <us...@apache.org>
Committed: Tue Apr 2 15:34:30 2013 +0300

----------------------------------------------------------------------
 ci/rat-excludes.txt |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/dce8e49e/ci/rat-excludes.txt
----------------------------------------------------------------------
diff --git a/ci/rat-excludes.txt b/ci/rat-excludes.txt
index 4155095..6a7d24a 100644
--- a/ci/rat-excludes.txt
+++ b/ci/rat-excludes.txt
@@ -9,6 +9,7 @@ proxy/config/
 **/*.la
 **/*.lai
 **/*.lo
+**/.dirstamp
 **/Makefile
 **/TODO
 .vimrc
@@ -18,6 +19,7 @@ proxy/config/
 .indent.pro
 aclocal.m4
 CHANGES
+CRUFT.txt
 autom4te.cache/
 build/
 LAYOUT


[03/50] git commit: TS-1791: remove m_mutex acquire&release to avoid deadlock

Posted by zw...@apache.org.
TS-1791: remove m_mutex acquire&release to avoid deadlock


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

Branch: refs/heads/3.3.x
Commit: 91ba85cac417088567c82bc626b71be64b568355
Parents: 349d11d
Author: Gang Li <qu...@taobao.com>
Authored: Mon Apr 1 16:35:31 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Tue Apr 2 15:36:59 2013 +0800

----------------------------------------------------------------------
 CHANGES                    |    3 +++
 proxy/logging/LogBuffer.cc |    4 +---
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/91ba85ca/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 8a5218a..9883ad7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-1791] remove m_mutex acquire&release to avoid deadlock in
+   ~LogBufferList(). Author: Gang Li <qu...@taobao.com>.
+   
   *) [TS-1713] SRV support refine. Now the srv option is able to enable, with
    no crash. Be care, the hostdb.storage_size or ostdb.size need check.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/91ba85ca/proxy/logging/LogBuffer.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogBuffer.cc b/proxy/logging/LogBuffer.cc
index 937247b..5cfab2a 100644
--- a/proxy/logging/LogBuffer.cc
+++ b/proxy/logging/LogBuffer.cc
@@ -764,12 +764,10 @@ LogBufferList::LogBufferList()
 LogBufferList::~LogBufferList()
 {
   LogBuffer *lb;
-  ink_mutex_acquire(&m_mutex);
-  m_size = 0;
   while ((lb = get()) != NULL) {
       delete lb;
   }
-  ink_mutex_release(&m_mutex);
+  m_size = 0;
   ink_mutex_destroy(&m_mutex);
 }
 


[42/50] git commit: TS-1806: bogus buffer sizing in CfgContextUtils.cc

Posted by zw...@apache.org.
TS-1806: bogus buffer sizing in CfgContextUtils.cc


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

Branch: refs/heads/3.3.x
Commit: 370fba9bf135df414be885403b8a4720cb35c696
Parents: b3d0fe7
Author: James Peach <jp...@apache.org>
Authored: Tue Apr 9 16:44:17 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Tue Apr 9 16:44:17 2013 -0700

----------------------------------------------------------------------
 CHANGES                     |    2 ++
 mgmt/api/CfgContextUtils.cc |    6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/370fba9b/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 11b87e4..59a196b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-1806] bogus buffer sizing in CfgContextUtils.cc
+
   *) [TS-1805] Fix stats ExpressionEval in stats xml.
    Author: Yunkai Zhang
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/370fba9b/mgmt/api/CfgContextUtils.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CfgContextUtils.cc b/mgmt/api/CfgContextUtils.cc
index 97c8ba3..32cb139 100644
--- a/mgmt/api/CfgContextUtils.cc
+++ b/mgmt/api/CfgContextUtils.cc
@@ -344,13 +344,15 @@ port_list_to_string(PortList * ports, const char *delimiter)
     if (port_ele->port_b != TS_INVALID_PORT) { //. is this a range
       // add in range delimiter & end of range
       if (pos < sizeof(buf) &&
-          (psize = snprintf(buf + pos, sizeof(buf) - pos, "%c%d", RANGE_DELIMITER, port_ele->port_b)) > 0)
+          (psize = snprintf(buf + pos, sizeof(buf) - pos, "%c%d", RANGE_DELIMITER, port_ele->port_b)) > 0) {
         pos += psize;
+      }
     }
 
     if (i != num_ports - 1) {
-      if (pos<sizeof(buf) && (psize = snprintf(buf + pos, sizeof(buf - pos), "%s", delimiter))> 0)
+      if (pos < sizeof(buf) && (psize = snprintf(buf + pos, sizeof(buf) - pos, "%s", delimiter))> 0) {
         pos += psize;
+      }
     }
 
     enqueue((LLQ *) ports, port_ele);   // return TSPortEle to list


[22/50] git commit: TS-1067 Remove unused config (and code) for bandwidth management

Posted by zw...@apache.org.
TS-1067 Remove unused config (and code) for bandwidth management


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

Branch: refs/heads/3.3.x
Commit: 197e918ca54289cb6f32a9dd7876e8ddcc587d60
Parents: bfc78c7
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Apr 2 15:32:35 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 15:32:35 2013 -0600

----------------------------------------------------------------------
 CHANGES |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/197e918c/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 04d63ad..70e5bff 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-1067] Remove unused config (and code) for bandwidth management.
+
   *) [TS-1736] Fatal() terminates process without a backtrace
     Author: Yunkai Zhang <yu...@gmail.com>
 


[23/50] git commit: TS-1067 Remove a few more unused variables, to get builds going

Posted by zw...@apache.org.
TS-1067 Remove a few more unused variables, to get builds going


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

Branch: refs/heads/3.3.x
Commit: 5cf774a13cf07b7bb66457d39ddf0e8a5abdd6ad
Parents: 197e918
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Apr 2 15:43:06 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 15:43:06 2013 -0600

----------------------------------------------------------------------
 iocore/net/UnixUDPNet.cc |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5cf774a1/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index ca428cb..f7b6eca 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -640,9 +640,6 @@ UDPQueue::service(UDPNetHandler * nh)
   uint64_t pktSendStartTime;
   UDPPacketInternal *p;
   ink_hrtime pktSendTime;
-  double minPktSpacing;
-  uint32_t pktSize;
-  int64_t pktLen;
 
   p = (UDPPacketInternal *) ink_atomiclist_popall(&atomicQueue);
   if (p) {
@@ -663,12 +660,9 @@ UDPQueue::service(UDPNetHandler * nh)
       ink_assert(p->link.next == NULL);
       // insert into our queue.
       Debug("udp-send", "Adding %p", p);
-      pktLen = p->getPktLength();
       if (p->conn->lastPktStartTime == 0) {
         pktSendStartTime = MAX(now, p->delivery_time);
       } else {
-        pktSize = MAX(INK_ETHERNET_MTU_SIZE, pktLen);
-        minPktSpacing = 0.0;
         pktSendTime = p->delivery_time;
         pktSendStartTime = MAX(MAX(now, pktSendTime), p->delivery_time);
       }
@@ -701,10 +695,6 @@ UDPQueue::SendPackets()
   int32_t bytesThisSlot = INT_MAX, bytesUsed = 0;
   int32_t bytesThisPipe, sentOne;
   int64_t pktLen;
-  ink_hrtime timeDelta = 0;
-
-  if (now > last_service)
-    timeDelta = ink_hrtime_to_msec(now - last_service);
 
   bytesThisSlot = INT_MAX;
 


[05/50] git commit: TS-1766: Add iocore/eventsystem tests to the build

Posted by zw...@apache.org.
TS-1766: Add iocore/eventsystem tests to the build


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

Branch: refs/heads/3.3.x
Commit: 2918fc1cf74a54cc0a17887fa0ebf75294c09365
Parents: dce8e49
Author: James Peach <jp...@apache.org>
Authored: Wed Mar 27 12:09:42 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Tue Apr 2 10:30:25 2013 -0700

----------------------------------------------------------------------
 iocore/eventsystem/I_IOBuffer.h   |    2 +-
 iocore/eventsystem/Makefile.am    |   32 ++++++
 iocore/eventsystem/test_Buffer.cc |   43 ++++----
 iocore/eventsystem/test_Event.cc  |  175 ++++++++++++++++++++++++++++++++
 iocore/eventsystem/test_Event.i   |  174 -------------------------------
 5 files changed, 230 insertions(+), 196 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2918fc1c/iocore/eventsystem/I_IOBuffer.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_IOBuffer.h b/iocore/eventsystem/I_IOBuffer.h
index 23a2ddc..3a8ab08 100644
--- a/iocore/eventsystem/I_IOBuffer.h
+++ b/iocore/eventsystem/I_IOBuffer.h
@@ -793,7 +793,7 @@ public:
   the center of all IOCore data transfer. MIOBuffers are the data
   buffers used to transfer data to and from VConnections. A MIOBuffer
   points to a list of IOBufferBlocks which in turn point to IOBufferData
-  stucutres that in turn point to the actual data. MIOBuffer allows one
+  structures that in turn point to the actual data. MIOBuffer allows one
   producer and multiple consumers. The buffer fills up according the
   amount of data outstanding for the slowest consumer. Thus, MIOBuffer
   implements automatic flow control between readers of different speeds.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2918fc1c/iocore/eventsystem/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/Makefile.am b/iocore/eventsystem/Makefile.am
index 0e002c1..59a8a24 100644
--- a/iocore/eventsystem/Makefile.am
+++ b/iocore/eventsystem/Makefile.am
@@ -22,6 +22,7 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib/ts
 
 DEFS += @IOCORE_MODULARIZED_DEFS@
+TESTS = $(check_PROGRAMS)
 
 noinst_LIBRARIES = libinkevent.a
 
@@ -67,3 +68,34 @@ libinkevent_a_SOURCES = \
   Inline.cc \
   Tasks.cc \
   I_Tasks.h
+
+check_PROGRAMS = test_Buffer test_Event
+
+test_CXXFLAGS = \
+  $(iocore_include_dirs) \
+  -I$(top_builddir)/proxy \
+  -I$(top_builddir)/proxy/api/ts \
+  -I$(top_srcdir)/proxy/api \
+  -I$(top_srcdir)/proxy \
+  -I$(top_srcdir)/proxy/hdrs \
+  -I$(top_srcdir)/proxy/http \
+  -I$(top_srcdir)/proxy/logging \
+  -I$(top_srcdir)/mgmt \
+  -I$(top_srcdir)/mgmt/utils
+
+test_LDADD = \
+  libinkevent.a \
+  $(top_builddir)/lib/records/librecprocess.a \
+  $(top_builddir)/mgmt/libmgmt_p.a \
+  $(top_builddir)/mgmt/utils/libutils_p.a \
+  $(top_builddir)/iocore/eventsystem/libinkevent.a \
+  $(top_builddir)/lib/ts/libtsutil.la
+
+test_Buffer_SOURCES = ../../proxy/UglyLogStubs.cc test_Buffer.cc
+test_Event_SOURCES = ../../proxy/UglyLogStubs.cc test_Event.cc
+test_Buffer_CXXFLAGS = $(test_CXXFLAGS)
+test_Event_CXXFLAGS = $(test_CXXFLAGS)
+
+test_Buffer_LDADD = $(test_LDADD)
+test_Event_LDADD = $(test_LDADD)
+

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2918fc1c/iocore/eventsystem/test_Buffer.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/test_Buffer.cc b/iocore/eventsystem/test_Buffer.cc
index e0b8f23..5638368 100644
--- a/iocore/eventsystem/test_Buffer.cc
+++ b/iocore/eventsystem/test_Buffer.cc
@@ -22,14 +22,18 @@
  */
 
 #include "I_EventSystem.h"
+#include "I_Layout.h"
 
 #define TEST_TIME_SECOND 60
 #define TEST_THREADS     2
 
-int count;
 Diags *diags;
 #define DIAGS_LOG_FILE "diags.log"
 
+void syslog_thr_init(void)
+{
+}
+
 //////////////////////////////////////////////////////////////////////////////
 //
 //      void reconfigure_diags()
@@ -45,7 +49,6 @@ reconfigure_diags()
   int i;
   DiagsConfigState c;
 
-
   // initial value set to 0 or 1 based on command line tags
   c.enabled[DiagsTagType_Debug] = (diags->base_debug_tags != NULL);
   c.enabled[DiagsTagType_Action] = (diags->base_action_tags != NULL);
@@ -54,7 +57,6 @@ reconfigure_diags()
   c.enabled[DiagsTagType_Action] = 1;
   diags->show_location = 1;
 
-
   // read output routing values
   for (i = 0; i < DiagsLevel_Count; i++) {
 
@@ -91,10 +93,8 @@ reconfigure_diags()
 
 }
 
-
-
 static void
-init_diags(char *bdt, char *bat)
+init_diags(const char *bdt, const char *bat)
 {
   FILE *diags_log_fp;
   char diags_logpath[500];
@@ -113,41 +113,42 @@ init_diags(char *bdt, char *bat)
   diags = NEW(new Diags(bdt, bat, diags_log_fp));
 
   if (diags_log_fp == NULL) {
-    SrcLoc loc(__FILE__, __FUNCTION__, __LINE__);
-
-    diags->print(NULL, DL_Warning, NULL, &loc,
-                 "couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
+    Warning("couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
   }
 
-  diags->print(NULL, DL_Status, "STATUS", NULL, "opened %s", diags_logpath);
+  Status("opened %s", diags_logpath);
   reconfigure_diags();
 
 }
 
-
 int
-main()
+main(int argc, const char *argv[])
 {
   RecModeT mode_type = RECM_STAND_ALONE;
-  count = 0;
+
+  Layout::create();
+  init_diags("", NULL);
   RecProcessInit(mode_type);
 
   ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION);
   eventProcessor.start(TEST_THREADS);
 
-  for (int i = 0; i < 100; i++) {
+  for (unsigned i = 0; i < 100; ++i) {
     MIOBuffer *b1 = new_MIOBuffer(default_large_iobuffer_size);
     IOBufferReader *b1reader = b1->alloc_reader();
-    b1->fill(1024 * 3);
+    b1->fill(b1->write_avail());
+
     MIOBuffer *b2 = new_MIOBuffer(default_large_iobuffer_size);
     IOBufferReader *b2reader = b2->alloc_reader();
-    b2->fill(1024 * 3);
+    b2->fill(b2->write_avail());
+
     //b1->write(b2reader, 2*1024);
+
     free_MIOBuffer(b2);
-    /* leak this */
-    b1 = NULL;
-    if ((i % 20) == 0)
-      xdump_to_file(stderr);
+    free_MIOBuffer(b1);
+
+    NOWARN_UNUSED(b1reader);
+    NOWARN_UNUSED(b2reader);
   }
 
   exit(0);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2918fc1c/iocore/eventsystem/test_Event.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/test_Event.cc b/iocore/eventsystem/test_Event.cc
new file mode 100644
index 0000000..cc4b9db
--- /dev/null
+++ b/iocore/eventsystem/test_Event.cc
@@ -0,0 +1,175 @@
+/** @file
+
+  A brief file description
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "I_EventSystem.h"
+#include "I_Layout.h"
+
+#define TEST_TIME_SECOND 60
+#define TEST_THREADS     2
+
+int count;
+Diags *diags;
+#define DIAGS_LOG_FILE "diags.log"
+
+void syslog_thr_init(void)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//      void reconfigure_diags()
+//
+//      This function extracts the current diags configuration settings from
+//      records.config, and rebuilds the Diags data structures.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+static void
+reconfigure_diags()
+{
+  int i;
+  DiagsConfigState c;
+
+  // initial value set to 0 or 1 based on command line tags
+  c.enabled[DiagsTagType_Debug] = (diags->base_debug_tags != NULL);
+  c.enabled[DiagsTagType_Action] = (diags->base_action_tags != NULL);
+
+  c.enabled[DiagsTagType_Debug] = 1;
+  c.enabled[DiagsTagType_Action] = 1;
+  diags->show_location = 1;
+
+  // read output routing values
+  for (i = 0; i < DiagsLevel_Count; i++) {
+
+    c.outputs[i].to_stdout = 0;
+    c.outputs[i].to_stderr = 1;
+    c.outputs[i].to_syslog = 1;
+    c.outputs[i].to_diagslog = 1;
+  }
+
+  //////////////////////////////
+  // clear out old tag tables //
+  //////////////////////////////
+
+  diags->deactivate_all(DiagsTagType_Debug);
+  diags->deactivate_all(DiagsTagType_Action);
+
+  //////////////////////////////////////////////////////////////////////
+  //                     add new tag tables
+  //////////////////////////////////////////////////////////////////////
+
+  if (diags->base_debug_tags)
+    diags->activate_taglist(diags->base_debug_tags, DiagsTagType_Debug);
+  if (diags->base_action_tags)
+    diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
+
+  ////////////////////////////////////
+  // change the diags config values //
+  ////////////////////////////////////
+#if !defined(__GNUC__) && !defined(hpux)
+  diags->config = c;
+#else
+  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
+#endif
+
+}
+
+static void
+init_diags(const char *bdt, const char *bat)
+{
+  FILE *diags_log_fp;
+  char diags_logpath[500];
+  strcpy(diags_logpath, DIAGS_LOG_FILE);
+
+  diags_log_fp = fopen(diags_logpath, "w");
+  if (diags_log_fp) {
+    int status;
+    status = setvbuf(diags_log_fp, NULL, _IOLBF, 512);
+    if (status != 0) {
+      fclose(diags_log_fp);
+      diags_log_fp = NULL;
+    }
+  }
+
+  diags = NEW(new Diags(bdt, bat, diags_log_fp));
+
+  if (diags_log_fp == NULL) {
+    Warning("couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
+  }
+
+  Status("opened %s", diags_logpath);
+  reconfigure_diags();
+
+}
+
+struct alarm_printer:public Continuation
+{
+  alarm_printer(ProxyMutex * m):Continuation(m)
+  {
+    SET_HANDLER(&alarm_printer::dummy_function);
+  }
+  int dummy_function(int event, Event * e)
+  {
+    ink_atomic_increment((int *) &count, 1);
+    printf("Count = %d\n", count);
+    return 0;
+  }
+};
+struct process_killer:public Continuation
+{
+  process_killer(ProxyMutex * m):Continuation(m)
+  {
+    SET_HANDLER(&process_killer::kill_function);
+  }
+  int kill_function(int event, Event * e)
+  {
+    printf("Count is %d \n", count);
+    if (count <= 0)
+      exit(1);
+    if (count > TEST_TIME_SECOND * TEST_THREADS)
+      exit(1);
+    exit(0);
+    return 0;
+  }
+};
+
+int
+main(int argc, const char *argv[])
+{
+  RecModeT mode_type = RECM_STAND_ALONE;
+  count = 0;
+
+  Layout::create();
+  init_diags("", NULL);
+  RecProcessInit(mode_type);
+
+  ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION);
+  eventProcessor.start(TEST_THREADS);
+
+  alarm_printer *alrm = new alarm_printer(new_ProxyMutex());
+  process_killer *killer = new process_killer(new_ProxyMutex());
+  eventProcessor.schedule_in(killer, HRTIME_SECONDS(10));
+  eventProcessor.schedule_every(alrm, HRTIME_SECONDS(1));
+  this_thread()->execute();
+  return 0;
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2918fc1c/iocore/eventsystem/test_Event.i
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/test_Event.i b/iocore/eventsystem/test_Event.i
deleted file mode 100644
index 3370047..0000000
--- a/iocore/eventsystem/test_Event.i
+++ /dev/null
@@ -1,174 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#define TEST_TIME_SECOND 60
-#define TEST_THREADS     2
-
-int count;
-Diags *diags;
-#define DIAGS_LOG_FILE "diags.log"
-
-//////////////////////////////////////////////////////////////////////////////
-//
-//      void reconfigure_diags()
-//
-//      This function extracts the current diags configuration settings from
-//      records.config, and rebuilds the Diags data structures.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-static void
-reconfigure_diags()
-{
-  int i;
-  DiagsConfigState c;
-
-
-  // initial value set to 0 or 1 based on command line tags
-  c.enabled[DiagsTagType_Debug] = (diags->base_debug_tags != NULL);
-  c.enabled[DiagsTagType_Action] = (diags->base_action_tags != NULL);
-
-  c.enabled[DiagsTagType_Debug] = 1;
-  c.enabled[DiagsTagType_Action] = 1;
-  diags->show_location = 1;
-
-
-  // read output routing values
-  for (i = 0; i < DiagsLevel_Count; i++) {
-
-    c.outputs[i].to_stdout = 0;
-    c.outputs[i].to_stderr = 1;
-    c.outputs[i].to_syslog = 1;
-    c.outputs[i].to_diagslog = 1;
-  }
-
-  //////////////////////////////
-  // clear out old tag tables //
-  //////////////////////////////
-
-  diags->deactivate_all(DiagsTagType_Debug);
-  diags->deactivate_all(DiagsTagType_Action);
-
-  //////////////////////////////////////////////////////////////////////
-  //                     add new tag tables 
-  //////////////////////////////////////////////////////////////////////
-
-  if (diags->base_debug_tags)
-    diags->activate_taglist(diags->base_debug_tags, DiagsTagType_Debug);
-  if (diags->base_action_tags)
-    diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
-
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
-#if !defined(__GNUC__) && !defined(hpux)
-  diags->config = c;
-#else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
-#endif
-
-}
-
-
-
-static void
-init_diags(char *bdt, char *bat)
-{
-  FILE *diags_log_fp;
-  char diags_logpath[500];
-  strcpy(diags_logpath, DIAGS_LOG_FILE);
-
-  diags_log_fp = fopen(diags_logpath, "w");
-  if (diags_log_fp) {
-    int status;
-    status = setvbuf(diags_log_fp, NULL, _IOLBF, 512);
-    if (status != 0) {
-      fclose(diags_log_fp);
-      diags_log_fp = NULL;
-    }
-  }
-
-  diags = NEW(new Diags(bdt, bat, diags_log_fp));
-
-  if (diags_log_fp == NULL) {
-    SrcLoc loc(__FILE__, __FUNCTION__, __LINE__);
-
-    diags->print(NULL, DL_Warning, NULL, &loc,
-                 "couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
-  }
-
-  diags->print(NULL, DL_Status, "STATUS", NULL, "opened %s", diags_logpath);
-  reconfigure_diags();
-
-}
-
-struct alarm_printer:public Continuation
-{
-  alarm_printer(ProxyMutex * m):Continuation(m)
-  {
-    SET_HANDLER(&alarm_printer::dummy_function);
-  }
-  int dummy_function(int event, Event * e)
-  {
-    ink_atomic_increment((int *) &count, 1);
-    printf("Count = %d\n", count);
-    return 0;
-  }
-};
-struct process_killer:public Continuation
-{
-  process_killer(ProxyMutex * m):Continuation(m)
-  {
-    SET_HANDLER(&process_killer::kill_function);
-  }
-  int kill_function(int event, Event * e)
-  {
-    printf("Count is %d \n", count);
-    if (count <= 0)
-      exit(1);
-    if (count > TEST_TIME_SECOND * TEST_THREADS)
-      exit(1);
-    exit(0);
-    return 0;
-  }
-};
-
-
-
-int
-main(int argc, char *argv[])
-{
-  RecModeT mode_type = RECM_STAND_ALONE;
-  count = 0;
-  RecProcessInit(mode_type);
-
-  ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION);
-  eventProcessor.start(TEST_THREADS);
-
-  alarm_printer *alrm = new alarm_printer(new_ProxyMutex());
-  process_killer *killer = new process_killer(new_ProxyMutex());
-  eventProcessor.schedule_in(killer, HRTIME_SECONDS(60));
-  eventProcessor.schedule_every(alrm, HRTIME_SECONDS(1));
-  this_thread()->execute();
-  return 0;
-}


[48/50] git commit: Add some new generated output files from the RAT checks.

Posted by zw...@apache.org.
Add some new generated output files from the RAT checks.


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

Branch: refs/heads/3.3.x
Commit: d6ab2dc42e5fa1a6bcc8ca98fd5ae738be1b7c4f
Parents: 41f1c2e
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Apr 15 14:44:32 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Apr 15 14:44:32 2013 -0600

----------------------------------------------------------------------
 ci/rat-excludes.txt |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6ab2dc4/ci/rat-excludes.txt
----------------------------------------------------------------------
diff --git a/ci/rat-excludes.txt b/ci/rat-excludes.txt
index 6a7d24a..ebb4f0d 100644
--- a/ci/rat-excludes.txt
+++ b/ci/rat-excludes.txt
@@ -110,3 +110,9 @@ plugins/experimental/esi/parser_test
 plugins/experimental/esi/processor_test
 plugins/experimental/esi/utils_test
 plugins/experimental/esi/vars_test
+iocore/aio/diags.log
+iocore/aio/test_AIO
+iocore/aio/test_AIO.sample
+iocore/eventsystem/diags.log
+iocore/eventsystem/test_Buffer
+iocore/eventsystem/test_Event


[02/50] git commit: add TS-1713

Posted by zw...@apache.org.
add TS-1713


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

Branch: refs/heads/3.3.x
Commit: 349d11d217a77e11be5746450c4af9fef581d3ea
Parents: 7b2bc02
Author: Zhao Yongming <mi...@gmail.com>
Authored: Tue Apr 2 15:30:41 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Tue Apr 2 15:30:41 2013 +0800

----------------------------------------------------------------------
 CHANGES |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/349d11d2/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index a31e7c8..8a5218a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-1713] SRV support refine. Now the srv option is able to enable, with
+   no crash. Be care, the hostdb.storage_size or ostdb.size need check.
+
   *) [TS-1632] In addition to the changes from TS-1674, also add
    some safety measures assuring that the stats sums don't go
    negative. Author: Yakov Kopel.


[33/50] git commit: TS-1760: clean up and fix --enable-linux-native-aio

Posted by zw...@apache.org.
TS-1760: clean up and fix --enable-linux-native-aio

Tidy the --enable-linux-native-aio to conform with autoconf
conventions. Use the correct TS_USE_LINUX_NATIVE_AIO macro to enable
Linux AIO support.


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

Branch: refs/heads/3.3.x
Commit: 12c478a2a71faf8bc70ea52469532c2947fde922
Parents: a34fb91
Author: James Peach <jp...@apache.org>
Authored: Wed Apr 3 09:59:42 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed Apr 3 10:01:43 2013 -0700

----------------------------------------------------------------------
 configure.ac       |   29 ++++++++++++++++-------------
 iocore/aio/I_AIO.h |    3 ++-
 2 files changed, 18 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/12c478a2/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index dbf1679..f237ebe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -397,25 +397,28 @@ TS_ARG_ENABLE_VAR([use], [reclaimable_freelist])
 AC_SUBST(use_reclaimable_freelist)
 
 #
-# If the OS is linux, we can use '--use_linux_native_aio' option to
+# If the OS is linux, we can use the '--enable-linux-native-aio' option to
 # replace the aio thread mode. Effective only on the linux system.
 #
 
-if test "x${host_os_def}" = "xlinux"; then
-  AC_MSG_CHECKING([whether to use native aio or not])
-  AC_ARG_ENABLE([linux_native_aio],
-    [AS_HELP_STRING([--enable-linux-native-aio],
-      [turn on linux native aio, only effective on linux system])],
-    [],
-    [enable_linux_native_aio="yes"])
-  AC_MSG_RESULT([$enable_linux_native_aio])
-else
-  enable_linux_native_aio="no"
-fi
+AC_MSG_CHECKING([whether to enable Linux native AIO])
+AC_ARG_ENABLE([linux-native-aio],
+  [AS_HELP_STRING([--enable-linux-native-aio], [enable native Linux AIO support @<:@default=no@:>@])],
+  [enable_linux_native_aio="${enableval}"],
+  [enable_linux_native_aio=no]
+)
+
+case $host_os in
+  linux*);;
+  *) AS_IF([test "x$enable_linux_native_aio" = "xyes"], [
+      AC_MSG_ERROR([Linux native AIO can only be enabled on Linux systems])
+    ])
+esac
+
+AC_MSG_RESULT([$enable_linux_native_aio])
 TS_ARG_ENABLE_VAR([use], [linux_native_aio])
 AC_SUBST(use_linux_native_aio)
 
-
 # Configure how many stats to allocate for plugins. Default is 512.
 #
 AC_ARG_WITH([max-api-stats],

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/12c478a2/iocore/aio/I_AIO.h
----------------------------------------------------------------------
diff --git a/iocore/aio/I_AIO.h b/iocore/aio/I_AIO.h
index ccdc078..ef49d93 100644
--- a/iocore/aio/I_AIO.h
+++ b/iocore/aio/I_AIO.h
@@ -47,7 +47,8 @@
 #define AIO_MODE_SYNC            1
 #define AIO_MODE_THREAD          2
 #define AIO_MODE_NATIVE          3
-#if use_linux_native_aio
+
+#if TS_USE_LINUX_NATIVE_AIO
 #define AIO_MODE                 AIO_MODE_NATIVE
 #else
 #define AIO_MODE                 AIO_MODE_THREAD


[32/50] git commit: Clean up --enable-reclaimable-freelist help string

Posted by zw...@apache.org.
Clean up --enable-reclaimable-freelist help string


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

Branch: refs/heads/3.3.x
Commit: 0b2bfcd729783c65a974a6991151269619b51dd4
Parents: ce3ab8c
Author: James Peach <jp...@apache.org>
Authored: Wed Apr 3 09:53:07 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed Apr 3 10:01:27 2013 -0700

----------------------------------------------------------------------
 configure.ac |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0b2bfcd7/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 72e60b0..7a6145a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -384,10 +384,9 @@ AC_SUBST(use_freelist)
 #
 if test "x${enable_freelist}" = "xyes"; then
   AC_MSG_CHECKING([whether to enable reclaimable freelist])
-  AC_ARG_ENABLE([reclaimable_freelist],
+  AC_ARG_ENABLE([reclaimable-freelist],
 		[AS_HELP_STRING([--enable-reclaimable-freelist],
-				[turn on reclaimable freelist, this option is effective
-				 only when freelist is enable])],
+				[enable reclaimable freelist support (effective only when freelist is enabled)])],
 		[],
 		[enable_recalimable_freelist="yes"])
   AC_MSG_RESULT([$enable_reclaimable_freelist])


[41/50] git commit: Remove obsolete mgr.cnf config file

Posted by zw...@apache.org.
Remove obsolete mgr.cnf config file


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

Branch: refs/heads/3.3.x
Commit: b3d0fe7b58169a9ded90bea6a9d002b75d1e29a4
Parents: 2d24177
Author: James Peach <jp...@apache.org>
Authored: Mon Apr 8 14:21:23 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 8 14:21:23 2013 -0700

----------------------------------------------------------------------
 mgmt/Main.cc                 |    3 ---
 proxy/config/Makefile.am     |    1 -
 proxy/config/mgr.cnf.default |    9 ---------
 3 files changed, 0 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b3d0fe7b/mgmt/Main.cc
----------------------------------------------------------------------
diff --git a/mgmt/Main.cc b/mgmt/Main.cc
index 06f3e6a..da80cad 100644
--- a/mgmt/Main.cc
+++ b/mgmt/Main.cc
@@ -1068,9 +1068,6 @@ fileUpdated(char *fname)
   } else if (strcmp(fname, "hosting.config") == 0) {
     lmgmt->signalFileChange("proxy.config.cache.hosting_filename");
 
-  } else if (strcmp(fname, "mgr.cnf") == 0) {
-    mgmt_log(stderr, "[fileUpdated] mgr.cnf file has been modified\n");
-
   } else if (strcmp(fname, "log_hosts.config") == 0) {
     lmgmt->signalFileChange("proxy.config.log.hosts_config_file");
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b3d0fe7b/proxy/config/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/config/Makefile.am b/proxy/config/Makefile.am
index 19de021..21f7f72 100644
--- a/proxy/config/Makefile.am
+++ b/proxy/config/Makefile.am
@@ -35,7 +35,6 @@ dist_sysconf_DATA =	\
   ip_allow.config.default \
   log_hosts.config.default \
   logs_xml.config.default \
-  mgr.cnf.default \
   parent.config.default \
   volume.config.default \
   plugin.config.default \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b3d0fe7b/proxy/config/mgr.cnf.default
----------------------------------------------------------------------
diff --git a/proxy/config/mgr.cnf.default b/proxy/config/mgr.cnf.default
deleted file mode 100644
index 0f909cd..0000000
--- a/proxy/config/mgr.cnf.default
+++ /dev/null
@@ -1,9 +0,0 @@
-#Entry type: usmUserEntry
-#Format:  usmUserEngineID  (octetString)
-#         usmUserName  (text)
-#         usmUserAuthProtocol  (OID)
-#         usmUserPrivProtocol  (OID)
-#         usmUserStorageType  (nonVolatile, permanent, readOnly)
-#         usmTargetTag  (text)
-usmUserEntry  localSnmpID rootNoAuthTemplate usmNoAuthProtocol \
-    usmNoPrivProtocol readOnly -


[15/50] git commit: TS-1067 Remove the InkPipeInfo wrapper, step one towards removing the global

Posted by zw...@apache.org.
TS-1067 Remove the InkPipeInfo wrapper, step one towards removing the global


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

Branch: refs/heads/3.3.x
Commit: c3ebba387c31a87065dd58c96428b1b5c114439b
Parents: e669312
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 09:56:32 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:52:33 2013 -0600

----------------------------------------------------------------------
 iocore/net/P_UDPNet.h    |    7 +-----
 iocore/net/UnixUDPNet.cc |   49 +++++++++++++---------------------------
 proxy/Main.cc            |    3 +-
 3 files changed, 18 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c3ebba38/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index 239ab34..44917f2 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -373,11 +373,6 @@ struct InkSinglePipeInfo
   PacketQueue *queue;
 };
 
-struct InkPipeInfo
-{
-  InkSinglePipeInfo *perPipeInfo;
-};
-
-extern InkPipeInfo G_inkPipeInfo;
+extern InkSinglePipeInfo G_inkPipeInfo;
 
 #endif //__P_UDPNET_H_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c3ebba38/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index 029d8cc..e0e3cd7 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -59,8 +59,7 @@ int32_t g_udp_numSendRetries;
 // Public functions
 // See header for documentation
 //
-
-InkPipeInfo G_inkPipeInfo;
+InkSinglePipeInfo G_inkPipeInfo;
 
 int G_bwGrapherFd;
 sockaddr_in6 G_bwGrapherLoc;
@@ -656,7 +655,6 @@ UDPQueue::service(UDPNetHandler * nh)
   double minPktSpacing;
   uint32_t pktSize;
   int64_t pktLen;
-  bool addToGuaranteedQ;
 
   (void) nh;
   static ink_hrtime lastPrintTime = ink_get_hrtime_internal();
@@ -690,21 +688,13 @@ UDPQueue::service(UDPNetHandler * nh)
       }
       // insert into our queue.
       Debug("udp-send", "Adding %p", p);
-      addToGuaranteedQ = ((p->conn->pipe_class > 0) && (p->conn->flowRateBps > 10.0));
       pktLen = p->getPktLength();
       if (p->conn->lastPktStartTime == 0) {
         p->pktSendStartTime = MAX(now, p->delivery_time);
       } else {
         pktSize = MAX(INK_ETHERNET_MTU_SIZE, pktLen);
-        if (addToGuaranteedQ) {
-          // NOTE: this is flow rate in Bytes per sec.; convert to milli-sec.
-          minPktSpacing = 1000.0 / (p->conn->flowRateBps / p->conn->avgPktSize);
-
-          pktSendTime = p->conn->lastPktStartTime + ink_hrtime_from_msec((uint32_t) minPktSpacing);
-        } else {
-          minPktSpacing = 0.0;
-          pktSendTime = p->delivery_time;
-        }
+        minPktSpacing = 0.0;
+        pktSendTime = p->delivery_time;
         p->pktSendStartTime = MAX(MAX(now, pktSendTime), p->delivery_time);
         if (p->conn->flowRateBps > 25600.0)
           Debug("udpnet-pkt", "Pkt size = %.1lf now = %" PRId64 ", send = %" PRId64 ", del = %" PRId64 ", Delay delta = %" PRId64 "; delta = %" PRId64 "",
@@ -720,14 +710,7 @@ UDPQueue::service(UDPNetHandler * nh)
       p->conn->nBytesTodo += pktLen;
 
       g_udp_bytesPending += pktLen;
-
-      if (addToGuaranteedQ)
-        G_inkPipeInfo.perPipeInfo[p->conn->pipe_class].queue->addPacket(p, now);
-      else {
-        // stick in the best-effort queue: either it was a best-effort flow or
-        // the thingy wasn't alloc'ed bandwidth
-        G_inkPipeInfo.perPipeInfo[0].queue->addPacket(p, now);
-      }
+      G_inkPipeInfo.queue->addPacket(p, now);
     }
   }
 
@@ -739,7 +722,7 @@ UDPQueue::service(UDPNetHandler * nh)
     lastPrintTime = now;
   }
 
-  G_inkPipeInfo.perPipeInfo[0].queue->advanceNow(now);
+  G_inkPipeInfo.queue->advanceNow(now);
   SendPackets();
 
   timeSpent = ink_hrtime_to_msec(now - last_report);
@@ -752,12 +735,12 @@ UDPQueue::service(UDPNetHandler * nh)
       totalBw = 1.0;
 
     // bw is in Mbps
-    bw = (G_inkPipeInfo.perPipeInfo[0].bytesSent * 8.0 * 1000.0) / (timeSpent * 1024.0 * 1024.0);
+    bw = (G_inkPipeInfo.bytesSent * 8.0 * 1000.0) / (timeSpent * 1024.0 * 1024.0);
 
     // use a weighted estimator of current usage
-    G_inkPipeInfo.perPipeInfo[0].bwUsed = (4.0 * G_inkPipeInfo.perPipeInfo[0].bwUsed / 5.0) + (bw / 5.0);
-    G_inkPipeInfo.perPipeInfo[0].bytesSent = 0;
-    G_inkPipeInfo.perPipeInfo[0].pktsSent = 0;
+    G_inkPipeInfo.bwUsed = (4.0 * G_inkPipeInfo.bwUsed / 5.0) + (bw / 5.0);
+    G_inkPipeInfo.bytesSent = 0;
+    G_inkPipeInfo.pktsSent = 0;
 
     bytesSent = 0;
     last_report = now;
@@ -809,10 +792,10 @@ UDPQueue::SendPackets()
 sendPackets:
   sentOne = false;
   send_threshold_time = now + SLOT_TIME;
-  bytesThisPipe = (int32_t) (bytesThisSlot * G_inkPipeInfo.perPipeInfo[0].wt);
+  bytesThisPipe = (int32_t) (bytesThisSlot * G_inkPipeInfo.wt);
 
-  while ((bytesThisPipe > 0) && (G_inkPipeInfo.perPipeInfo[0].queue->firstPacket(send_threshold_time))) {
-    p = G_inkPipeInfo.perPipeInfo[0].queue->getFirstPacket();
+  while ((bytesThisPipe > 0) && (G_inkPipeInfo.queue->firstPacket(send_threshold_time))) {
+    p = G_inkPipeInfo.queue->getFirstPacket();
     pktLen = p->getPktLength();
     g_udp_bytesPending -= pktLen;
 
@@ -823,7 +806,7 @@ sendPackets:
     if (p->conn->GetSendGenerationNumber() != p->reqGenerationNum)
       goto next_pkt;
 
-    G_inkPipeInfo.perPipeInfo[0].bytesSent += pktLen;
+    G_inkPipeInfo.bytesSent += pktLen;
     SendUDPPacket(p, pktLen);
     bytesUsed += pktLen;
     bytesThisPipe -= pktLen;
@@ -840,8 +823,8 @@ sendPackets:
   if ((bytesThisSlot > 0) && (sentOne)) {
     // redistribute the slack...
     now = ink_get_hrtime_internal();
-    if (G_inkPipeInfo.perPipeInfo[0].queue->firstPacket(now) == NULL) {
-      G_inkPipeInfo.perPipeInfo[0].queue->advanceNow(now);
+    if (G_inkPipeInfo.queue->firstPacket(now) == NULL) {
+      G_inkPipeInfo.queue->advanceNow(now);
     }
     goto sendPackets;
   }
@@ -851,7 +834,7 @@ sendPackets:
     uint64_t nbytes = g_udp_bytesPending;
     ink_hrtime startTime = ink_get_hrtime_internal(), endTime;
 
-    G_inkPipeInfo.perPipeInfo[0].queue->FreeCancelledPackets(g_udp_periodicCleanupSlots);
+    G_inkPipeInfo.queue->FreeCancelledPackets(g_udp_periodicCleanupSlots);
     endTime = ink_get_hrtime_internal();
     Debug("udp-pending-packets", "Did cleanup of %d buckets: %" PRId64 " bytes in %" PRId64 " m.sec",
           g_udp_periodicCleanupSlots, nbytes - g_udp_bytesPending, (int64_t)ink_hrtime_to_msec(endTime - startTime));

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c3ebba38/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index a22098e..dfde9c8 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -1523,8 +1523,7 @@ main(int argc, char **argv)
 
   // This was the default when we had no bandwidth_mgmt.filename to load
   // but I don't know for sure if we still need this.
-  G_inkPipeInfo.perPipeInfo = NEW(new InkSinglePipeInfo[1]);
-  G_inkPipeInfo.perPipeInfo[0].wt = 1.0;
+  G_inkPipeInfo.wt = 1.0;
 
   init_http_header();
 


[39/50] git commit: TS-1805: fix conversion when pass value to statVarSet()

Posted by zw...@apache.org.
TS-1805: fix conversion when pass value to statVarSet()

The result from NodeStatEval()/ClusterStatEval() could have different type
compare to the token type of m_node_dest/m_cluster_dest.

So we should do conversion in statVarSet() when they are different.

Signed-off-by: Yunkai Zhang <qi...@taobao.com>
Signed-off-by: Zhao Yongming <mi...@gmail.com>


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

Branch: refs/heads/3.3.x
Commit: e935ebaeb6fd9ba75c4103800beef26c19d1c8fe
Parents: eabab3e
Author: Yunkai Zhang <qi...@taobao.com>
Authored: Sun Apr 7 20:55:32 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Mon Apr 8 10:50:29 2013 +0800

----------------------------------------------------------------------
 CHANGES                     |    3 +
 mgmt/stats/StatProcessor.cc |    3 +-
 mgmt/stats/StatType.cc      |   82 +++++++++++++++++++++++++++-----------
 mgmt/stats/StatType.h       |    6 +-
 4 files changed, 67 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e935ebae/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 3ee67b2..11b87e4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-1805] Fix stats ExpressionEval in stats xml.
+   Author: Yunkai Zhang
+
   *) [TS-1783] Eliminate the wpad.dat configuration option (it's unused).
 
   *) [TS-1787] Eliminate old ink_time code (was probably only used by the

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e935ebae/mgmt/stats/StatProcessor.cc
----------------------------------------------------------------------
diff --git a/mgmt/stats/StatProcessor.cc b/mgmt/stats/StatProcessor.cc
index 98ce28d..26e8c2a 100644
--- a/mgmt/stats/StatProcessor.cc
+++ b/mgmt/stats/StatProcessor.cc
@@ -312,11 +312,12 @@ StatProcessor::processStat()
 RecData
 ExpressionEval(char *exprString)
 {
+  RecDataT result_type;
   StatObject statObject;
 
   char content[BUFSIZ * 10];
   XML_extractContent(exprString, content, BUFSIZ * 10);
 
   statObject.assignExpr(content);
-  return statObject.NodeStatEval(false);
+  return statObject.NodeStatEval(&result_type, false);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e935ebae/mgmt/stats/StatType.cc
----------------------------------------------------------------------
diff --git a/mgmt/stats/StatType.cc b/mgmt/stats/StatType.cc
index 7a283cc..efdde92 100644
--- a/mgmt/stats/StatType.cc
+++ b/mgmt/stats/StatType.cc
@@ -156,10 +156,6 @@ bool StatExprToken::assignTokenType()
     m_token_type = RECD_FX;
   }
 
-  if (m_token_type == RECD_COUNTER) {
-    m_token_type = RECD_INT;
-  }
-
   if (m_token_value_delta) {
     m_token_value_delta->data_type = m_token_type;
   }
@@ -228,8 +224,10 @@ StatExprToken::precedence()
  * or larger than max, then the error value is assigned. If no
  * error value is assigned, either min. or max. is assigned.
  */
-bool StatExprToken::statVarSet(RecData value)
+bool StatExprToken::statVarSet(RecDataT type, RecData value)
 {
+  RecData converted_value;
+
   if (StatError) {
     /* fix this after librecords is done
        mgmt_log(stderr,
@@ -240,14 +238,47 @@ bool StatExprToken::statVarSet(RecData value)
     return varSetData(m_token_type, m_token_name, err_value);
   }
 
-  if (RecDataCmp(m_token_type, value, m_token_value_min) < 0) {
+  /*
+   * do conversion if necessary.
+   */
+  if (m_token_type != type) {
+    switch (m_token_type) {
+    case RECD_INT:
+    case RECD_COUNTER:
+      if (type == RECD_NULL)
+        converted_value = value;
+      else if (type == RECD_INT || type == RECD_COUNTER || type == RECD_FX)
+        converted_value.rec_int = value.rec_int;
+      else if (type == RECD_FLOAT || type == RECD_CONST)
+        converted_value.rec_int = (RecInt)value.rec_float;
+      else
+        Fatal("invalid value type:%d\n", m_token_type);
+      break;
+    case RECD_FLOAT:
+      if (type == RECD_NULL)
+        converted_value = value;
+      else if (type == RECD_INT || type == RECD_COUNTER || type == RECD_FX)
+        converted_value.rec_float = (RecFloat)value.rec_int;
+      else if (type == RECD_FLOAT || type == RECD_CONST)
+        converted_value.rec_float = value.rec_float;
+      else
+        Fatal("invalid value type:%d\n", m_token_type);
+      break;
+    default:
+      Fatal("unsupported token type:%d\n", m_token_type);
+    }
+  } else {
+    converted_value = value;
+  }
+
+  if (RecDataCmp(m_token_type, converted_value, m_token_value_min) < 0) {
     value = m_token_value_min;
   }
-  else if (RecDataCmp(m_token_type, value, m_token_value_max) > 0) {
+  else if (RecDataCmp(m_token_type, converted_value, m_token_value_max) > 0) {
     value = m_token_value_max;
   }
 
-  return varSetData(m_token_type, m_token_name, value);
+  return varSetData(m_token_type, m_token_name, converted_value);
 }
 
 
@@ -632,7 +663,7 @@ StatObject::infix2postfix()
  *
  *
  */
-RecData StatObject::NodeStatEval(bool cluster)
+RecData StatObject::NodeStatEval(RecDataT *result_type, bool cluster)
 {
   StatExprList stack;
   StatExprToken *left = NULL;
@@ -653,8 +684,10 @@ RecData StatObject::NodeStatEval(bool cluster)
     }
 
     if (src->m_token_type == RECD_CONST) {
+      *result_type = RECD_CONST;
       tempValue = src->m_token_value;
     } else if (src->m_token_value_delta) {
+      *result_type = src->m_token_type;
       tempValue = src->m_token_value_delta->diff_value(src->m_token_name);
     } else if (!cluster) {
       if (!varDataFromName(src->m_token_type, src->m_token_name, &tempValue)) {
@@ -704,6 +737,7 @@ RecData StatObject::NodeStatEval(bool cluster)
       ink_debug_assert(false);
     }
 
+    *result_type = stack.top()->m_token_type;
     tempValue = stack.top()->m_token_value;
   }
 
@@ -718,7 +752,7 @@ RecData StatObject::NodeStatEval(bool cluster)
  *
  *
  */
-RecData StatObject::ClusterStatEval()
+RecData StatObject::ClusterStatEval(RecDataT *result_type)
 {
   RecData tempValue;
 
@@ -727,11 +761,12 @@ RecData StatObject::ClusterStatEval()
 
   // what is this?
   if ((m_node_dest == NULL) || (m_cluster_dest->m_sum_var == false)) {
-    return NodeStatEval(true);
+    return NodeStatEval(result_type, true);
   } else {
     if (!overviewGenerator->varClusterDataFromName(m_node_dest->m_token_type,
                                                    m_node_dest->m_token_name,
                                                    &tempValue)) {
+      *result_type = RECD_NULL;
       RecDataClear(RECD_NULL, &tempValue);
     }
     return (tempValue);
@@ -986,6 +1021,7 @@ StatObjectList::Eval()
 {
   RecData tempValue;
   RecData result;
+  RecDataT result_type;
   ink_hrtime threshold = 0;
   ink_hrtime delta = 0;
   short count = 0;
@@ -1006,13 +1042,13 @@ StatObjectList::Eval()
       object->m_current_time = ink_get_hrtime_internal();
 
       if (object->m_node_dest) {
-        result = object->NodeStatEval(false);
-        object->m_node_dest->statVarSet(result);
+        result = object->NodeStatEval(&result_type, false);
+        object->m_node_dest->statVarSet(result_type, result);
       }
 
       if (object->m_cluster_dest) {
-        result = object->ClusterStatEval();
-        object->m_cluster_dest->statVarSet(result);
+        result = object->ClusterStatEval(&result_type);
+        object->m_cluster_dest->statVarSet(result_type, result);
       }
 
       object->m_last_update = object->m_current_time;
@@ -1051,13 +1087,13 @@ StatObjectList::Eval()
           }
 
           if (object->m_node_dest) {
-            result = object->NodeStatEval(false);
-            object->m_node_dest->statVarSet(result);
+            result = object->NodeStatEval(&result_type, false);
+            object->m_node_dest->statVarSet(result_type, result);
           }
 
           if (object->m_cluster_dest) {
-            result = object->ClusterStatEval();
-            object->m_cluster_dest->statVarSet(result);
+            result = object->ClusterStatEval(&result_type);
+            object->m_cluster_dest->statVarSet(result_type, result);
           }
 
           object->m_last_update = object->m_current_time;
@@ -1083,13 +1119,13 @@ StatObjectList::Eval()
 
           if (delta > threshold) {
             if (object->m_node_dest) {
-              result = object->NodeStatEval(false);
-              object->m_node_dest->statVarSet(result);
+              result = object->NodeStatEval(&result_type, false);
+              object->m_node_dest->statVarSet(result_type, result);
             }
 
             if (object->m_cluster_dest) {
-              result = object->ClusterStatEval();
-              object->m_cluster_dest->statVarSet(result);
+              result = object->ClusterStatEval(&result_type);
+              object->m_cluster_dest->statVarSet(result_type, result);
             }
 
             object->m_last_update = object->m_current_time;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e935ebae/mgmt/stats/StatType.h
----------------------------------------------------------------------
diff --git a/mgmt/stats/StatType.h b/mgmt/stats/StatType.h
index 3d56ee3..673e1e7 100644
--- a/mgmt/stats/StatType.h
+++ b/mgmt/stats/StatType.h
@@ -114,7 +114,7 @@ public:
   };
   void clean();
 
-  bool statVarSet(RecData);
+  bool statVarSet(RecDataT, RecData);
 };
 
 
@@ -189,8 +189,8 @@ public:
   void assignExpr(char *);
 
   StatExprToken *StatBinaryEval(StatExprToken *, char, StatExprToken *, bool cluster = false);
-  RecData NodeStatEval(bool cluster);
-  RecData ClusterStatEval();
+  RecData NodeStatEval(RecDataT *result_type, bool cluster);
+  RecData ClusterStatEval(RecDataT *result_type);
   void setTokenValue(StatExprToken *, bool cluster = false);
 
 private: