Author: zwoop
Date: Fri Jan 28 23:09:14 2011
New Revision: 1064924
URL: http://svn.apache.org/viewvc?rev=1064924&view=rev
Log:
TS-655 Reorganize some code to reduce binary foot prints.
And obviously less co-dependencies between modules.
Added:
trafficserver/traffic/trunk/proxy/UglyLogStubs.cc
trafficserver/traffic/trunk/proxy/logging/LogConfigCollation.cc
Modified:
trafficserver/traffic/trunk/iocore/eventsystem/I_Continuation.h
trafficserver/traffic/trunk/iocore/eventsystem/I_Processor.h
trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc
trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h
trafficserver/traffic/trunk/iocore/hostdb/P_HostDBProcessor.h
trafficserver/traffic/trunk/proxy/Makefile.am
trafficserver/traffic/trunk/proxy/logging/LogCollationAccept.cc
trafficserver/traffic/trunk/proxy/logging/LogCollationAccept.h
trafficserver/traffic/trunk/proxy/logging/LogCollationClientSM.cc
trafficserver/traffic/trunk/proxy/logging/LogConfig.cc
trafficserver/traffic/trunk/proxy/logging/LogHost.cc
trafficserver/traffic/trunk/proxy/logging/Makefile.am
Modified: trafficserver/traffic/trunk/iocore/eventsystem/I_Continuation.h
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/eventsystem/I_Continuation.h?rev=1064924&r1=1064923&r2=1064924&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/eventsystem/I_Continuation.h (original)
+++ trafficserver/traffic/trunk/iocore/eventsystem/I_Continuation.h Fri Jan 28
23:09:14 2011
@@ -91,8 +91,7 @@ public:
*/
-// TODO: The ICCcompiler defaults this to "private", is that really correct?
-class Continuation: public force_VFPT_to_top
+class Continuation: private force_VFPT_to_top
{
public:
Modified: trafficserver/traffic/trunk/iocore/eventsystem/I_Processor.h
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/eventsystem/I_Processor.h?rev=1064924&r1=1064923&r2=1064924&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/eventsystem/I_Processor.h (original)
+++ trafficserver/traffic/trunk/iocore/eventsystem/I_Processor.h Fri Jan 28
23:09:14 2011
@@ -56,7 +56,7 @@ class Thread;
class Processor
{
public:
- virtual ~ Processor();
+ virtual ~Processor();
/**
Returns a Thread appropriate for the processor.
Modified: trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc?rev=1064924&r1=1064923&r2=1064924&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc Fri Jan 28 23:09:14 2011
@@ -104,14 +104,6 @@ register_ShowHostDB(Continuation * c, HT
#endif
-//
-// Initialization
-//
-HostDBProcessor::HostDBProcessor()
-{
-}
-
-
HostDBCache::HostDBCache()
{
tag_bits = HOST_DB_TAG_BITS;
Modified: trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h?rev=1064924&r1=1064923&r2=1064924&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h Fri Jan 28
23:09:14 2011
@@ -434,15 +434,16 @@ struct HostDBProcessor: public Processor
HOSTDB_DO_NOT_ROUND_ROBIN = 4
};
- inkcoreapi Action *getbyname_re(Continuation * cont, char *hostname, int len
= 0,
- int port = 0, int flags =
HOSTDB_DO_NOT_FORCE_DNS);
+ HostDBProcessor()
+ { }
- Action *getSRVbyname_imm(Continuation * cont, process_srv_info_pfn
process_srv_info,
- char *hostname, int len = 0, int port = 0, int
flags = HOSTDB_DO_NOT_FORCE_DNS, int timeout =
- 0);
+ inkcoreapi Action *getbyname_re(Continuation * cont, char *hostname, int len
= 0, int port = 0,
+ int flags = HOSTDB_DO_NOT_FORCE_DNS);
- Action *getbyname_imm(Continuation * cont, process_hostdb_info_pfn
process_hostdb_info,
- char *hostname, int len = 0,
+ Action *getSRVbyname_imm(Continuation * cont, process_srv_info_pfn
process_srv_info, char *hostname, int len = 0,
+ int port = 0, int flags = HOSTDB_DO_NOT_FORCE_DNS,
int timeout = 0);
+
+ Action *getbyname_imm(Continuation * cont, process_hostdb_info_pfn
process_hostdb_info, char *hostname, int len = 0,
int port = 0, int flags = HOSTDB_DO_NOT_FORCE_DNS, int
timeout = 0);
@@ -489,7 +490,6 @@ struct HostDBProcessor: public Processor
unsigned int ip, bool aforce_dns, int timeout = 0);
void setby(char *hostname, int len, int port, unsigned int aip,
HostDBApplicationInfo * app);
- HostDBProcessor();
};
void run_HostDBTest();
Modified: trafficserver/traffic/trunk/iocore/hostdb/P_HostDBProcessor.h
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/P_HostDBProcessor.h?rev=1064924&r1=1064923&r2=1064924&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/P_HostDBProcessor.h (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/P_HostDBProcessor.h Fri Jan 28
23:09:14 2011
@@ -22,10 +22,7 @@
*/
/****************************************************************************
-
P_HostDBProcessor.h
-
-
****************************************************************************/
#ifndef _P_HostDBProcessor_h_
@@ -34,8 +31,7 @@
#include "I_HostDBProcessor.h"
-#define HOSTDB_CLIENT_IP_HASH(_client_ip,_ip) \
-(((_client_ip >> 16)^_client_ip^_ip^(_ip>>16))&0xFFFF)
+#define HOSTDB_CLIENT_IP_HASH(_client_ip,_ip) (((_client_ip >>
16)^_client_ip^_ip^(_ip>>16))&0xFFFF)
//
// Constants
@@ -355,7 +351,6 @@ extern int hostdb_cluster_round_robin;
extern int hostdb_lookup_timeout;
extern int hostdb_insert_timeout;
extern int hostdb_re_dns_on_reload;
-extern HostDBProcessor hostDBProcessor;
// 0 = obey, 1 = ignore, 2 = min(X,ttl), 3 = max(X,ttl)
enum
Modified: trafficserver/traffic/trunk/proxy/Makefile.am
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Makefile.am?rev=1064924&r1=1064923&r2=1064924&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Makefile.am (original)
+++ trafficserver/traffic/trunk/proxy/Makefile.am Fri Jan 28 23:09:14 2011
@@ -138,6 +138,7 @@ traffic_server_LDADD = \
http/remap/libhttp_remap.a \
congest/libCongestionControl.a \
logging/liblogging.a \
+ logging/liblogcollation.a \
stats/libstats.a \
hdrs/libhdrs.a \
$(top_builddir)/mgmt/preparse/libpreparse.a \
@@ -164,51 +165,13 @@ traffic_server_LDADD = \
traffic_logcat_SOURCES = logcat.cc
traffic_logcat_LDFLAGS = @EXTRA_CXX_LDFLAGS@
traffic_logcat_LDADD = \
- ICP.o \
- ICPConfig.o \
- ICPProcessor.o \
- ICPStats.o \
- IPAllow.o \
- ParentSelection.o \
- ControlBase.o \
- ControlMatcher.o CacheControl.o \
- StatSystem.o \
- ReverseProxy.o \
- ProxyConfig.o \
signals.o \
- Error.o \
- EventName.o \
- DiagsConfig.o \
- StatPages.o \
- PluginVC.o \
- AbstractBuffer.o \
- Transform.o \
- Prefetch.o \
- Update.o \
- Plugin.o \
- PluginDB.o \
- InkAPI.o \
- FetchSM.o \
- InkIOCoreAPI.o \
InkXml.o \
- http/libhttp.a \
- http/remap/libhttp_remap.a \
+ DiagsConfig.o \
+ UglyLogStubs.o \
logging/liblogging.a \
- stats/libstats.a \
- hdrs/libhdrs.a \
- congest/libCongestionControl.a \
- $(top_builddir)/mgmt/preparse/libpreparse.a \
$(top_builddir)/mgmt/utils/libutils_p.a \
$(top_builddir)/mgmt/libmgmt_p.a \
- $(top_builddir)/iocore/cluster/libinkcluster.a \
- $(top_builddir)/iocore/dns/libinkdns.a \
- $(top_builddir)/iocore/hostdb/libinkhostdb.a \
- $(top_builddir)/iocore/cluster/libinkcluster.a \
- $(top_builddir)/iocore/cache/libinkcache.a \
- $(top_builddir)/iocore/utils/libinkutils.a \
- $(top_builddir)/iocore/aio/libinkaio.a \
- $(top_builddir)/iocore/net/libinknet.a \
- $(top_builddir)/iocore/eventsystem/libinkevent.a \
$(top_builddir)/lib/records/librecprocess.a \
$(top_builddir)/iocore/eventsystem/libinkevent.a \
$(top_builddir)/lib/ts/libtsutil.la \
@@ -225,53 +188,13 @@ endif
traffic_logstats_SOURCES = logstats.cc
traffic_logstats_LDFLAGS = @EXTRA_CXX_LDFLAGS@
traffic_logstats_LDADD = \
- ICP.o \
- ICPConfig.o \
- ICPProcessor.o \
- ICPStats.o \
- IPAllow.o \
- ParentSelection.o \
- ControlBase.o \
- ControlMatcher.o \
- CacheControl.o \
- StatSystem.o \
- ReverseProxy.o \
- ProxyConfig.o \
signals.o \
- Error.o \
- EventName.o \
- DiagsConfig.o \
- StatPages.o \
- PluginVC.o \
- AbstractBuffer.o \
- Transform.o \
- Prefetch.o \
- Update.o \
- Plugin.o \
- PluginDB.o \
- InkAPI.o \
- FetchSM.o \
- InkIOCoreAPI.o \
InkXml.o \
- http/libhttp.a \
- http/remap/libhttp_remap.a \
+ DiagsConfig.o \
+ UglyLogStubs.o \
logging/liblogging.a \
- stats/libstats.a \
- hdrs/libhdrs.a \
- congest/libCongestionControl.a \
- $(top_builddir)/mgmt/preparse/libpreparse.a \
$(top_builddir)/mgmt/utils/libutils_p.a \
$(top_builddir)/mgmt/libmgmt_p.a \
- $(top_builddir)/iocore/cluster/libinkcluster.a \
- $(top_builddir)/iocore/dns/libinkdns.a \
- $(top_builddir)/iocore/hostdb/libinkhostdb.a \
- $(top_builddir)/iocore/dns/libinkdns.a \
- $(top_builddir)/iocore/cluster/libinkcluster.a \
- $(top_builddir)/iocore/cache/libinkcache.a \
- $(top_builddir)/iocore/utils/libinkutils.a \
- $(top_builddir)/iocore/aio/libinkaio.a \
- $(top_builddir)/iocore/net/libinknet.a \
- $(top_builddir)/iocore/eventsystem/libinkevent.a \
$(top_builddir)/lib/records/librecprocess.a \
$(top_builddir)/iocore/eventsystem/libinkevent.a \
$(top_builddir)/lib/ts/libtsutil.la \
@@ -280,11 +203,6 @@ traffic_logstats_LDADD = \
@LIBEXPAT@ @LIBDEMANGLE@ @LIBMLD@ @LIBEXC@ @LIBICONV@ @LIBM@ @LIBPROFILER@ \
@LIBEXECINFO@
-if BUILD_TESTS
- traffic_logstats_LDADD += RegressionSM.o \
- TestHook.o
-endif
-
traffic_sac_SOURCES = sac.cc
traffic_sac_LDFLAGS = @EXTRA_CXX_LDFLAGS@
traffic_sac_LDADD = \
@@ -320,6 +238,7 @@ traffic_sac_LDADD = \
http/remap/libhttp_remap.a \
congest/libCongestionControl.a \
logging/liblogging.a \
+ logging/liblogcollation.a \
stats/libstats.a \
hdrs/libhdrs.a \
$(top_builddir)/mgmt/preparse/libpreparse.a \
Added: trafficserver/traffic/trunk/proxy/UglyLogStubs.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/UglyLogStubs.cc?rev=1064924&view=auto
==============================================================================
--- trafficserver/traffic/trunk/proxy/UglyLogStubs.cc (added)
+++ trafficserver/traffic/trunk/proxy/UglyLogStubs.cc Fri Jan 28 23:09:14 2011
@@ -0,0 +1,113 @@
+/** @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.
+*/
+
+
+
+// This is total BS, because our libraries are riddled with cross dependencies.
+// TODO: Clean up the dependency mess, and get rid of this.
+
+#include "libts.h"
+#include "LogObject.h"
+
+#if defined(solaris)
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+
+#include "P_Net.h"
+
+int fds_limit = 8000;
+UDPNetProcessor &udpNet;
+
+ClassAllocator<UDPPacketInternal> udpPacketAllocator("udpPacketAllocator");
+
+void
+UDPConnection::Release()
+{
+ ink_release_assert(false);
+}
+
+void
+UDPNetProcessor::FreeBandwidth(Continuation * udpConn)
+{
+ ink_release_assert(false);
+}
+
+NetProcessor& netProcessor;
+
+Action *
+UnixNetProcessor::connect_re_internal(Continuation * cont, unsigned int ip,
int port, NetVCOptions * opt)
+{
+ ink_release_assert(false);
+ return NULL;
+}
+
+
+#include "InkAPIInternal.h"
+ConfigUpdateCbTable *global_config_cbs = NULL;
+
+void
+ConfigUpdateCbTable::invoke(const char *name)
+{
+ ink_release_assert(false);
+}
+
+const char *
+event_int_to_string(int event, int blen, char *buffer)
+{
+ ink_release_assert(false);
+ return NULL;
+}
+
+
+struct Machine;
+Machine *
+this_machine()
+{
+ ink_release_assert(false);
+ return NULL;
+}
+
+
+#include "LogConfig.h"
+void
+LogConfig::setup_collation(LogConfig * prev_config)
+{
+ ink_release_assert(false);
+}
+
+void
+LogConfig::create_pre_defined_objects_with_filter(const
PreDefinedFormatInfoList & pre_def_info_list, size_t num_filters,
+ LogFilter ** filter, const
char *filt_name, bool force_extension)
+{
+ ink_release_assert(false);
+}
+
+int
+LogHost::write(LogBuffer * lb, size_t * to_disk, size_t * to_net, size_t *
to_pipe)
+{
+ ink_release_assert(false);
+ return 0;
+}
+
Modified: trafficserver/traffic/trunk/proxy/logging/LogCollationAccept.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogCollationAccept.cc?rev=1064924&r1=1064923&r2=1064924&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogCollationAccept.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogCollationAccept.cc Fri Jan 28
23:09:14 2011
@@ -37,9 +37,9 @@
//-------------------------------------------------------------------------
LogCollationAccept::LogCollationAccept(int port):
-Continuation(new_ProxyMutex()),
-m_port(port),
-m_pending_event(NULL)
+ Continuation(new_ProxyMutex()),
+ m_port(port),
+ m_pending_event(NULL)
{
SET_HANDLER((LogCollationAcceptHandler) & LogCollationAccept::accept_event);
Modified: trafficserver/traffic/trunk/proxy/logging/LogCollationAccept.h
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogCollationAccept.h?rev=1064924&r1=1064923&r2=1064924&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogCollationAccept.h (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogCollationAccept.h Fri Jan 28
23:09:14 2011
@@ -30,14 +30,12 @@ struct LogCollationAccept: public Contin
{
public:
-
LogCollationAccept(int port);
~LogCollationAccept();
int accept_event(int event, NetVConnection * net_vc);
private:
-
int m_port;
Action *m_accept_action;
Event *m_pending_event;
Modified: trafficserver/traffic/trunk/proxy/logging/LogCollationClientSM.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogCollationClientSM.cc?rev=1064924&r1=1064923&r2=1064924&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogCollationClientSM.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogCollationClientSM.cc Fri Jan
28 23:09:14 2011
@@ -53,26 +53,24 @@
// statics
//-------------------------------------------------------------------------
-int
- LogCollationClientSM::ID = 0;
+int LogCollationClientSM::ID = 0;
//-------------------------------------------------------------------------
// LogCollationClientSM::LogCollationClientSM
//-------------------------------------------------------------------------
LogCollationClientSM::LogCollationClientSM(LogHost * log_host):
-Continuation(new_ProxyMutex()),
-m_host_vc(NULL),
-m_host_vio(NULL),
-m_auth_buffer(NULL),
-m_auth_reader(NULL),
-m_send_buffer(NULL),
-m_send_reader(NULL),
-m_pending_action(NULL),
-m_pending_event(NULL),
-m_buffer_send_list(NULL), m_buffer_in_iocore(NULL),
m_flow(LOG_COLL_FLOW_ALLOW), m_log_host(log_host), m_id(ID++)
+ Continuation(new_ProxyMutex()),
+ m_host_vc(NULL),
+ m_host_vio(NULL),
+ m_auth_buffer(NULL),
+ m_auth_reader(NULL),
+ m_send_buffer(NULL),
+ m_send_reader(NULL),
+ m_pending_action(NULL),
+ m_pending_event(NULL),
+ m_buffer_send_list(NULL), m_buffer_in_iocore(NULL),
m_flow(LOG_COLL_FLOW_ALLOW), m_log_host(log_host), m_id(ID++)
{
-
Debug("log-coll", "[%d]client::constructor", m_id);
ink_assert(m_log_host != NULL);
@@ -93,7 +91,6 @@ m_buffer_send_list(NULL), m_buffer_in_io
LogCollationClientSM::~LogCollationClientSM()
{
-
Debug("log-coll", "[%d]client::destructor", m_id);
ink_mutex_acquire(&(mutex->the_mutex));
@@ -116,7 +113,6 @@ LogCollationClientSM::~LogCollationClien
int
LogCollationClientSM::client_handler(int event, void *data)
{
-
switch (m_client_state) {
case LOG_COLL_CLIENT_AUTH:
return client_auth(event, (VIO *) data);
@@ -140,7 +136,6 @@ LogCollationClientSM::client_handler(int
ink_assert(!"unexpcted state");
return EVENT_CONT;
}
-
}
//-------------------------------------------------------------------------
@@ -158,7 +153,6 @@ LogCollationClientSM::client_handler(int
int
LogCollationClientSM::send(LogBuffer * log_buffer)
{
-
// take lock (can block on call because we're on our own thread)
ink_mutex_acquire(&(mutex->the_mutex));
@@ -212,7 +206,6 @@ LogCollationClientSM::send(LogBuffer * l
ink_mutex_release(&(mutex->the_mutex));
return bytes_to_write;
-
}
//-------------------------------------------------------------------------
@@ -235,7 +228,6 @@ LogCollationClientSM::client_auth(int ev
Debug("log-coll", "[%d]client::client_auth", m_id);
switch (event) {
-
case LOG_COLL_EVENT_SWITCH:
{
Debug("log-coll", "[%d]client::client_auth - SWITCH", m_id);
@@ -291,9 +283,7 @@ LogCollationClientSM::client_auth(int ev
default:
ink_assert(!"unexpected event");
return EVENT_CONT;
-
}
-
}
#ifndef INK_NO_HOSTDB
@@ -350,7 +340,6 @@ LogCollationClientSM::client_done(int ev
Debug("log-coll", "[%d]client::client_done", m_id);
switch (event) {
-
case LOG_COLL_EVENT_SWITCH:
m_client_state = LOG_COLL_CLIENT_DONE;
@@ -465,7 +454,6 @@ LogCollationClientSM::client_fail(int ev
return EVENT_CONT;
}
-
}
//-------------------------------------------------------------------------
@@ -480,7 +468,6 @@ LogCollationClientSM::client_idle(int ev
Debug("log-coll", "[%d]client::client_idle", m_id);
switch (event) {
-
case LOG_COLL_EVENT_SWITCH:
m_client_state = LOG_COLL_CLIENT_IDLE;
return EVENT_CONT;
@@ -495,7 +482,6 @@ LogCollationClientSM::client_idle(int ev
return EVENT_CONT;
}
-
}
//-------------------------------------------------------------------------
@@ -510,7 +496,6 @@ LogCollationClientSM::client_init(int ev
Debug("log-coll", "[%d]client::client_init", m_id);
switch (event) {
-
case LOG_COLL_EVENT_SWITCH:
m_client_state = LOG_COLL_CLIENT_INIT;
ink_assert(m_pending_event == NULL);
@@ -557,7 +542,6 @@ LogCollationClientSM::client_init(int ev
return EVENT_CONT;
}
-
}
//-------------------------------------------------------------------------
@@ -568,32 +552,26 @@ LogCollationClientSM::client_init(int ev
int
LogCollationClientSM::client_open(int event, NetVConnection * net_vc)
{
-
Debug("log-coll", "[%d]client::client_open", m_id);
switch (event) {
-
case LOG_COLL_EVENT_SWITCH:
-
Debug("log-coll", "[%d]client::client_open - SWITCH", m_id);
m_client_state = LOG_COLL_CLIENT_OPEN;
{
- Action *connect_action_handle = netProcessor.connect_re(this,
- m_log_host->m_ip,
-
m_log_host->m_port);
+ Action *connect_action_handle = netProcessor.connect_re(this,
m_log_host->m_ip, m_log_host->m_port);
if (connect_action_handle != ACTION_RESULT_DONE) {
ink_assert(!m_pending_action);
m_pending_action = connect_action_handle;
- };
+ }
}
return EVENT_CONT;
case NET_EVENT_OPEN:
- Debug("log-coll", "[%d]client::client_open - %d.%d.%d.%d:%d",
- m_id,
+ Debug("log-coll", "[%d]client::client_open - %d.%d.%d.%d:%d", m_id,
((unsigned char *) (&(m_log_host->m_ip)))[0],
((unsigned char *) (&(m_log_host->m_ip)))[1],
((unsigned char *) (&(m_log_host->m_ip)))[2],
@@ -623,7 +601,6 @@ LogCollationClientSM::client_open(int ev
return EVENT_CONT;
}
-
}
//-------------------------------------------------------------------------
@@ -638,7 +615,6 @@ LogCollationClientSM::client_send(int ev
Debug("log-coll", "[%d]client::client_send", m_id);
switch (event) {
-
case EVENT_IMMEDIATE:
Debug("log-coll", "[%d]client::client_send - EVENT_IMMEDIATE", m_id);
// callback complete, reset m_pending_event
@@ -663,8 +639,7 @@ LogCollationClientSM::client_send(int ev
// enable m_flow if we're out of work to do
if (m_flow == LOG_COLL_FLOW_DENY && m_buffer_send_list->get_size() == 0)
{
Debug("log-coll", "[%d]client::client_send - m_flow = ALLOW", m_id);
- Note("[log-coll] send-queue clear; resuming collation "
- "[%d.%d.%d.%d:%d]",
+ Note("[log-coll] send-queue clear; resuming collation
[%d.%d.%d.%d:%d]",
((unsigned char *) (&(m_log_host->m_ip)))[0],
((unsigned char *) (&(m_log_host->m_ip)))[1],
((unsigned char *) (&(m_log_host->m_ip)))[2],
@@ -742,7 +717,6 @@ LogCollationClientSM::client_send(int ev
return client_fail(LOG_COLL_EVENT_SWITCH, NULL);
}
-
}
//-------------------------------------------------------------------------
@@ -757,11 +731,9 @@ LogCollationClientSM::client_send(int ev
//-------------------------------------------------------------------------
// LogCollationClientSM::flush_to_orphan
//-------------------------------------------------------------------------
-
void
LogCollationClientSM::flush_to_orphan()
{
-
Debug("log-coll", "[%d]client::flush_to_orphan", m_id);
// if in middle of a write, flush buffer_in_iocore to orphan
Modified: trafficserver/traffic/trunk/proxy/logging/LogConfig.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogConfig.cc?rev=1064924&r1=1064923&r2=1064924&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogConfig.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogConfig.cc Fri Jan 28 23:09:14
2011
@@ -657,76 +657,6 @@ LogConfig::~LogConfig()
}
/*-------------------------------------------------------------------------
- LogConfig::setup_collation
- -------------------------------------------------------------------------*/
-
-void
-LogConfig::setup_collation(LogConfig * prev_config)
-{
- // Set-up the collation status, but only if collation is enabled and
- // there are valid entries for the collation host and port.
- //
- if (collation_mode<NO_COLLATION || collation_mode>= N_COLLATION_MODES) {
- Note("Invalid value %d for proxy.local.log.collation_mode"
- " configuration variable (valid range is from %d to %d)\n"
- "Log collation disabled", collation_mode, NO_COLLATION,
N_COLLATION_MODES - 1);
- } else if (collation_mode == NO_COLLATION) {
- // if the previous configuration had a collation accept, delete it
- //
- if (prev_config && prev_config->m_log_collation_accept) {
- delete prev_config->m_log_collation_accept;
- prev_config->m_log_collation_accept = NULL;
- }
- } else {
- if (!collation_port) {
- Note("Cannot activate log collation, %d is and invalid " "collation
port", collation_port);
- } else if (collation_mode > COLLATION_HOST && strcmp(collation_host,
"none") == 0) {
- Note("Cannot activate log collation, \"%s\" is and invalid " "collation
host", collation_host);
- } else {
- if (collation_mode == COLLATION_HOST) {
-#if defined(IOCORE_LOG_COLLATION)
-
- ink_debug_assert(m_log_collation_accept == 0);
-
- if (prev_config && prev_config->m_log_collation_accept) {
- if (prev_config->collation_port == collation_port) {
- m_log_collation_accept = prev_config->m_log_collation_accept;
- } else {
- delete prev_config->m_log_collation_accept;
- }
- }
-
- if (!m_log_collation_accept) {
- Log::collation_port = collation_port;
- m_log_collation_accept = NEW(new LogCollationAccept(collation_port));
- }
-#else
- // since we are the collation host, we need to signal the
- // collate_cond variable so that our collation thread wakes up.
- //
- ink_cond_signal(&Log::collate_cond);
-#endif
- Debug("log", "I am a collation host listening on port %d.",
collation_port);
- } else {
- Debug("log", "I am a collation client (%d)."
- " My collation host is %s:%d", collation_mode, collation_host,
collation_port);
- }
-
-#ifdef IOCORE_LOG_COLLATION
- Debug("log", "using iocore log collation");
-#else
- Debug("log", "using socket log collation");
-#endif
- if (collation_host_tagged) {
- LogFormat::turn_tagging_on();
- } else {
- LogFormat::turn_tagging_off();
- }
- }
- }
-}
-
-/*-------------------------------------------------------------------------
LogConfig::init
-------------------------------------------------------------------------*/
@@ -962,55 +892,6 @@ LogConfig::add_filters_to_search_log_obj
#define MAXHOSTNAMELEN 256
#endif
-void
-LogConfig::create_pre_defined_objects_with_filter(const
PreDefinedFormatInfoList & pre_def_info_list, size_t num_filters,
- LogFilter ** filter, const
char *filt_name, bool force_extension)
-{
- PreDefinedFormatInfo *pdi;
- for (pdi = pre_def_info_list.head; pdi != NULL; pdi = (pdi->link).next) {
-
- char *obj_fname;
- char obj_filt_fname[PATH_MAX];
- if (filt_name) {
- ink_string_concatenate_strings_n(obj_filt_fname, PATH_MAX,
pdi->filename, "-", filt_name, NULL);
- obj_fname = obj_filt_fname;
- } else {
- obj_fname = pdi->filename;
- }
-
- if (force_extension) {
- ink_string_append(obj_filt_fname,
- (char *) (pdi->is_ascii ?
- ASCII_LOG_OBJECT_FILENAME_EXTENSION :
- BINARY_LOG_OBJECT_FILENAME_EXTENSION),
PATH_MAX);
- }
- // create object with filters
- //
- LogObject *obj;
- obj = NEW(new LogObject(pdi->format, logfile_dir, obj_fname,
- pdi->is_ascii ? ASCII_LOG : BINARY_LOG,
- pdi->header, rolling_enabled,
rolling_interval_sec, rolling_offset_hr, rolling_size_mb));
-
- if (collation_mode == SEND_STD_FMTS || collation_mode ==
SEND_STD_AND_NON_XML_CUSTOM_FMTS) {
-
- LogHost *loghost = NEW(new LogHost(obj->get_full_filename(),
- obj->get_signature()));
- ink_assert(loghost != NULL);
-
- loghost->set_name_port(collation_host, collation_port);
- obj->add_loghost(loghost, false);
- }
-
- for (size_t i = 0; i < num_filters; ++i) {
- obj->add_filter(filter[i]);
- }
-
- // give object to object manager
- //
- log_object_manager.manage_object(obj);
- }
-}
-
//-----------------------------------------------------------------------------
// split_by_protocol
//
@@ -2275,9 +2156,8 @@ LogConfig::read_xml_log_config(int from_
LogField *shn_field = Log::global_field_list.find_by_symbol("shn");
ink_assert(shn_field);
- LogFilterString
- server_host_filter("__xml_server_hosts__",
- shn_field, LogFilter::ACCEPT,
LogFilter::CASE_INSENSITIVE_CONTAIN, serverHosts_str);
+ LogFilterString server_host_filter("__xml_server_hosts__",
+ shn_field, LogFilter::ACCEPT,
LogFilter::CASE_INSENSITIVE_CONTAIN, serverHosts_str);
if (server_host_filter.get_num_values() == 0) {
Warning("No valid server host value(s) (%s) for Protocol "
@@ -2293,9 +2173,8 @@ LogConfig::read_xml_log_config(int from_
char *host;
SimpleTokenizer tok(collationHosts_str, ',');
while (host = tok.getNext(), host != 0) {
+ LogHost *lh = NEW(new LogHost(obj->get_full_filename(),
obj->get_signature()));
- LogHost *lh = NEW(new LogHost(obj->get_full_filename(),
- obj->get_signature()));
if (lh->set_name_or_ipstr(host)) {
Warning("Could not set \"%s\" as collation host", host);
delete lh;
Added: trafficserver/traffic/trunk/proxy/logging/LogConfigCollation.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogConfigCollation.cc?rev=1064924&view=auto
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogConfigCollation.cc (added)
+++ trafficserver/traffic/trunk/proxy/logging/LogConfigCollation.cc Fri Jan 28
23:09:14 2011
@@ -0,0 +1,265 @@
+/** @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.
+*/
+
+/***************************************************************************
+ LogConfigCollation.cc
+
+ This is a *huge* hack, in an attempt to isolate some of the collation
+ related code away from liblogging.a. Please fix this!
+
+***************************************************************************/
+#include "libts.h"
+#include "ink_platform.h"
+
+#include "LogFormatType.h"
+#include "LogLimits.h"
+#include "LogField.h"
+#include "LogFilter.h"
+#include "LogFormat.h"
+#include "LogFile.h"
+#include "LogBuffer.h"
+#include "LogHost.h"
+#include "LogObject.h"
+#include "LogConfig.h"
+#include "LogUtils.h"
+#include "Log.h"
+#include "SimpleTokenizer.h"
+
+#if defined(IOCORE_LOG_COLLATION)
+#include "LogCollationAccept.h"
+#endif
+
+
+void
+LogConfig::create_pre_defined_objects_with_filter(const
PreDefinedFormatInfoList & pre_def_info_list, size_t num_filters,
+ LogFilter ** filter, const
char *filt_name, bool force_extension)
+{
+ PreDefinedFormatInfo *pdi;
+ for (pdi = pre_def_info_list.head; pdi != NULL; pdi = (pdi->link).next) {
+
+ char *obj_fname;
+ char obj_filt_fname[PATH_MAX];
+ if (filt_name) {
+ ink_string_concatenate_strings_n(obj_filt_fname, PATH_MAX,
pdi->filename, "-", filt_name, NULL);
+ obj_fname = obj_filt_fname;
+ } else {
+ obj_fname = pdi->filename;
+ }
+
+ if (force_extension) {
+ ink_string_append(obj_filt_fname,
+ (char *) (pdi->is_ascii ?
+ ASCII_LOG_OBJECT_FILENAME_EXTENSION :
+ BINARY_LOG_OBJECT_FILENAME_EXTENSION),
PATH_MAX);
+ }
+ // create object with filters
+ //
+ LogObject *obj;
+ obj = NEW(new LogObject(pdi->format, logfile_dir, obj_fname,
+ pdi->is_ascii ? ASCII_LOG : BINARY_LOG,
+ pdi->header, rolling_enabled,
rolling_interval_sec, rolling_offset_hr, rolling_size_mb));
+
+ if (collation_mode == SEND_STD_FMTS || collation_mode ==
SEND_STD_AND_NON_XML_CUSTOM_FMTS) {
+
+ LogHost *loghost = NEW(new LogHost(obj->get_full_filename(),
+ obj->get_signature()));
+ ink_assert(loghost != NULL);
+
+ loghost->set_name_port(collation_host, collation_port);
+ obj->add_loghost(loghost, false);
+ }
+
+ for (size_t i = 0; i < num_filters; ++i) {
+ obj->add_filter(filter[i]);
+ }
+
+ // give object to object manager
+ //
+ log_object_manager.manage_object(obj);
+ }
+}
+
+/*-------------------------------------------------------------------------
+ LogConfig::setup_collation
+ -------------------------------------------------------------------------*/
+
+void
+LogConfig::setup_collation(LogConfig * prev_config)
+{
+ // Set-up the collation status, but only if collation is enabled and
+ // there are valid entries for the collation host and port.
+ //
+ if (collation_mode<NO_COLLATION || collation_mode>= N_COLLATION_MODES) {
+ Note("Invalid value %d for proxy.local.log.collation_mode"
+ " configuration variable (valid range is from %d to %d)\n"
+ "Log collation disabled", collation_mode, NO_COLLATION,
N_COLLATION_MODES - 1);
+ } else if (collation_mode == NO_COLLATION) {
+ // if the previous configuration had a collation accept, delete it
+ //
+ if (prev_config && prev_config->m_log_collation_accept) {
+ delete prev_config->m_log_collation_accept;
+ prev_config->m_log_collation_accept = NULL;
+ }
+ } else {
+ if (!collation_port) {
+ Note("Cannot activate log collation, %d is and invalid " "collation
port", collation_port);
+ } else if (collation_mode > COLLATION_HOST && strcmp(collation_host,
"none") == 0) {
+ Note("Cannot activate log collation, \"%s\" is and invalid " "collation
host", collation_host);
+ } else {
+ if (collation_mode == COLLATION_HOST) {
+#if defined(IOCORE_LOG_COLLATION)
+
+ ink_debug_assert(m_log_collation_accept == 0);
+
+ if (prev_config && prev_config->m_log_collation_accept) {
+ if (prev_config->collation_port == collation_port) {
+ m_log_collation_accept = prev_config->m_log_collation_accept;
+ } else {
+ delete prev_config->m_log_collation_accept;
+ }
+ }
+
+ if (!m_log_collation_accept) {
+ Log::collation_port = collation_port;
+ m_log_collation_accept = NEW(new LogCollationAccept(collation_port));
+ }
+#else
+ // since we are the collation host, we need to signal the
+ // collate_cond variable so that our collation thread wakes up.
+ //
+ ink_cond_signal(&Log::collate_cond);
+#endif
+ Debug("log", "I am a collation host listening on port %d.",
collation_port);
+ } else {
+ Debug("log", "I am a collation client (%d)."
+ " My collation host is %s:%d", collation_mode, collation_host,
collation_port);
+ }
+
+#ifdef IOCORE_LOG_COLLATION
+ Debug("log", "using iocore log collation");
+#else
+ Debug("log", "using socket log collation");
+#endif
+ if (collation_host_tagged) {
+ LogFormat::turn_tagging_on();
+ } else {
+ LogFormat::turn_tagging_off();
+ }
+ }
+ }
+}
+
+
+
+#if defined(IOCORE_LOG_COLLATION)
+#include "LogCollationClientSM.h"
+#endif
+
+#define PING true
+#define NOPING false
+
+int
+LogHost::write(LogBuffer * lb, size_t * to_disk, size_t * to_net, size_t *
to_pipe)
+{
+ NOWARN_UNUSED(to_pipe);
+ if (lb == NULL) {
+ Note("Cannot write LogBuffer to LogHost %s; LogBuffer is NULL", name());
+ return -1;
+ }
+ LogBufferHeader *buffer_header = lb->header();
+ if (buffer_header == NULL) {
+ Note("Cannot write LogBuffer to LogHost %s; LogBufferHeader is NULL",
name());
+ return -1;
+ }
+ if (buffer_header->entry_count == 0) {
+ // no bytes to write
+ return 0;
+ }
+#if !defined(IOCORE_LOG_COLLATION)
+
+ // make sure we're connected & authenticated
+
+ if (!connected(NOPING)) {
+ if (!connect()) {
+ Note("Cannot write LogBuffer to LogHost %s; not connected", name());
+ return orphan_write(lb);
+ }
+ }
+ // try sending the logbuffer
+
+ int bytes_to_send, bytes_sent;
+ bytes_to_send = buffer_header->byte_count;
+ lb->convert_to_network_order();
+ bytes_sent = m_sock->write(m_sock_fd, buffer_header, bytes_to_send);
+ if (bytes_to_send != bytes_sent) {
+ Note("Bad write to LogHost %s; bad send count %d/%d", name(), bytes_sent,
bytes_to_send);
+ disconnect();
+ lb->convert_to_host_order();
+ return orphan_write(lb);
+ }
+
+ Debug("log-host", "%d bytes sent to LogHost %s:%u", bytes_sent, name(),
port());
+ // BUGBUG:: fix this, Log Collation should work on NT as well
+ SUM_DYN_STAT(log_stat_bytes_sent_to_network_stat, bytes_sent);
+ return bytes_sent;
+
+#else // !defined(IOCORE_LOG_COLLATION)
+
+ // make a copy of our log_buffer
+ int buffer_header_size = buffer_header->byte_count;
+ LogBufferHeader *buffer_header_copy = (LogBufferHeader *) NEW(new
char[buffer_header_size]);
+ ink_assert(buffer_header_copy != NULL);
+
+ memcpy(buffer_header_copy, buffer_header, buffer_header_size);
+ LogBuffer *lb_copy = NEW(new LogBuffer(lb->get_owner(),
+ buffer_header_copy));
+ ink_assert(lb_copy != NULL);
+
+ // create a new collation client if necessary
+ if (m_log_collation_client_sm == NULL) {
+ m_log_collation_client_sm = NEW(new LogCollationClientSM(this));
+ ink_assert(m_log_collation_client_sm != NULL);
+ }
+ // send log_buffer; orphan if necessary
+ int bytes_sent = m_log_collation_client_sm->send(lb_copy);
+ if (bytes_sent <= 0) {
+#ifndef TS_MICRO
+ bytes_sent = orphan_write_and_delete(lb_copy, to_disk);
+#if defined(LOG_BUFFER_TRACKING)
+ Debug("log-buftrak", "[%d]LogHost::write - orphan write complete",
lb_copy->header()->id);
+#endif // defined(LOG_BUFFER_TRACKING)
+#else
+ Note("Starting dropping log buffer due to overloading");
+ delete lb_copy;
+ lb_copy = 0;
+#endif // TS_MICRO
+ } else {
+ if (to_net) {
+ *to_net += bytes_sent;
+ }
+ }
+
+ return bytes_sent;
+
+#endif // !defined(IOCORE_LOG_COLLATION)
+}
Modified: trafficserver/traffic/trunk/proxy/logging/LogHost.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogHost.cc?rev=1064924&r1=1064923&r2=1064924&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogHost.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogHost.cc Fri Jan 28 23:09:14
2011
@@ -225,91 +225,6 @@ LogHost::disconnect()
m_connected = false;
}
-int
-LogHost::write(LogBuffer * lb, size_t * to_disk, size_t * to_net, size_t *
to_pipe)
-{
- NOWARN_UNUSED(to_pipe);
- if (lb == NULL) {
- Note("Cannot write LogBuffer to LogHost %s; LogBuffer is NULL", name());
- return -1;
- }
- LogBufferHeader *buffer_header = lb->header();
- if (buffer_header == NULL) {
- Note("Cannot write LogBuffer to LogHost %s; LogBufferHeader is NULL",
name());
- return -1;
- }
- if (buffer_header->entry_count == 0) {
- // no bytes to write
- return 0;
- }
-#if !defined(IOCORE_LOG_COLLATION)
-
- // make sure we're connected & authenticated
-
- if (!connected(NOPING)) {
- if (!connect()) {
- Note("Cannot write LogBuffer to LogHost %s; not connected", name());
- return orphan_write(lb);
- }
- }
- // try sending the logbuffer
-
- int bytes_to_send, bytes_sent;
- bytes_to_send = buffer_header->byte_count;
- lb->convert_to_network_order();
- bytes_sent = m_sock->write(m_sock_fd, buffer_header, bytes_to_send);
- if (bytes_to_send != bytes_sent) {
- Note("Bad write to LogHost %s; bad send count %d/%d", name(), bytes_sent,
bytes_to_send);
- disconnect();
- lb->convert_to_host_order();
- return orphan_write(lb);
- }
-
- Debug("log-host", "%d bytes sent to LogHost %s:%u", bytes_sent, name(),
port());
- // BUGBUG:: fix this, Log Collation should work on NT as well
- SUM_DYN_STAT(log_stat_bytes_sent_to_network_stat, bytes_sent);
- return bytes_sent;
-
-#else // !defined(IOCORE_LOG_COLLATION)
-
- // make a copy of our log_buffer
- int buffer_header_size = buffer_header->byte_count;
- LogBufferHeader *buffer_header_copy = (LogBufferHeader *) NEW(new
char[buffer_header_size]);
- ink_assert(buffer_header_copy != NULL);
-
- memcpy(buffer_header_copy, buffer_header, buffer_header_size);
- LogBuffer *lb_copy = NEW(new LogBuffer(lb->get_owner(),
- buffer_header_copy));
- ink_assert(lb_copy != NULL);
-
- // create a new collation client if necessary
- if (m_log_collation_client_sm == NULL) {
- m_log_collation_client_sm = NEW(new LogCollationClientSM(this));
- ink_assert(m_log_collation_client_sm != NULL);
- }
- // send log_buffer; orphan if necessary
- int bytes_sent = m_log_collation_client_sm->send(lb_copy);
- if (bytes_sent <= 0) {
-#ifndef TS_MICRO
- bytes_sent = orphan_write_and_delete(lb_copy, to_disk);
-#if defined(LOG_BUFFER_TRACKING)
- Debug("log-buftrak", "[%d]LogHost::write - orphan write complete",
lb_copy->header()->id);
-#endif // defined(LOG_BUFFER_TRACKING)
-#else
- Note("Starting dropping log buffer due to overloading");
- delete lb_copy;
- lb_copy = 0;
-#endif // TS_MICRO
- } else {
- if (to_net) {
- *to_net += bytes_sent;
- }
- }
-
- return bytes_sent;
-
-#endif // !defined(IOCORE_LOG_COLLATION)
-}
void
LogHost::create_orphan_LogFile_object()
Modified: trafficserver/traffic/trunk/proxy/logging/Makefile.am
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/Makefile.am?rev=1064924&r1=1064923&r2=1064924&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/Makefile.am (original)
+++ trafficserver/traffic/trunk/proxy/logging/Makefile.am Fri Jan 28 23:09:14
2011
@@ -31,7 +31,7 @@ AM_CPPFLAGS = \
EXTRA_DIST = LogStandalone.cc
-noinst_LIBRARIES = liblogging.a
+noinst_LIBRARIES = liblogging.a liblogcollation.a
liblogging_a_SOURCES = \
LogAccess.cc \
@@ -46,13 +46,6 @@ liblogging_a_SOURCES = \
LogBufferV1.h \
Log.cc \
Log.h \
- LogCollationAccept.cc \
- LogCollationAccept.h \
- LogCollationBase.h \
- LogCollationClientSM.cc \
- LogCollationClientSM.h \
- LogCollationHostSM.cc \
- LogCollationHostSM.h \
LogConfig.cc \
LogConfig.h \
LogFieldAliasMap.cc \
@@ -66,12 +59,22 @@ liblogging_a_SOURCES = \
LogFormat.cc \
LogFormat.h \
LogFormatType.h \
- LogHost.cc \
- LogHost.h \
LogLimits.h \
LogObject.cc \
LogObject.h \
LogSock.cc \
LogSock.h \
+ LogHost.cc \
+ LogHost.h \
LogUtils.cc \
LogUtils.h
+
+liblogcollation_a_SOURCES = \
+ LogConfigCollation.cc \
+ LogCollationAccept.cc \
+ LogCollationAccept.h \
+ LogCollationBase.h \
+ LogCollationClientSM.cc \
+ LogCollationClientSM.h \
+ LogCollationHostSM.cc \
+ LogCollationHostSM.h