You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2010/12/16 02:45:46 UTC
svn commit: r1049764 [1/3] - in /trafficserver/traffic/trunk:
contrib/perl/AdminClient/lib/Apache/TS/ iocore/hostdb/ lib/records/ lib/ts/
proxy/ proxy/http2/ proxy/logging/ proxy/mgmt2/ proxy/mgmt2/api2/
proxy/mgmt2/cli2/ proxy/mgmt2/cluster/ proxy/mgm...
Author: zwoop
Date: Thu Dec 16 01:45:45 2010
New Revision: 1049764
URL: http://svn.apache.org/viewvc?rev=1049764&view=rev
Log:
TS-576 Remove old, mostly unused records code
Removed:
trafficserver/traffic/trunk/proxy/mgmt2/BaseRecords.cc
trafficserver/traffic/trunk/proxy/mgmt2/BaseRecords.h
trafficserver/traffic/trunk/proxy/mgmt2/LMRecords.cc
trafficserver/traffic/trunk/proxy/mgmt2/LMRecords.h
trafficserver/traffic/trunk/proxy/mgmt2/ProcessRecords.cc
trafficserver/traffic/trunk/proxy/mgmt2/ProcessRecords.h
trafficserver/traffic/trunk/proxy/mgmt2/utils/MgmtConverter.cc
trafficserver/traffic/trunk/proxy/mgmt2/utils/MgmtConverter.h
Modified:
trafficserver/traffic/trunk/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm
trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc
trafficserver/traffic/trunk/lib/records/I_RecCore.h
trafficserver/traffic/trunk/lib/records/P_RecCore.i
trafficserver/traffic/trunk/lib/records/P_RecDefs.h
trafficserver/traffic/trunk/lib/records/RecCore.cc
trafficserver/traffic/trunk/lib/ts/Diags.cc
trafficserver/traffic/trunk/proxy/Main.cc
trafficserver/traffic/trunk/proxy/ProxyConfig.h
trafficserver/traffic/trunk/proxy/StatSystem.cc
trafficserver/traffic/trunk/proxy/StatSystem.h
trafficserver/traffic/trunk/proxy/http2/HttpTransact.h
trafficserver/traffic/trunk/proxy/logging/LogStandalone.cc
trafficserver/traffic/trunk/proxy/mgmt2/FileManager.cc
trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.cc
trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.h
trafficserver/traffic/trunk/proxy/mgmt2/Main.cc
trafficserver/traffic/trunk/proxy/mgmt2/Makefile.am
trafficserver/traffic/trunk/proxy/mgmt2/ProcessManager.cc
trafficserver/traffic/trunk/proxy/mgmt2/ProcessManager.h
trafficserver/traffic/trunk/proxy/mgmt2/RecordsConfig.cc
trafficserver/traffic/trunk/proxy/mgmt2/RecordsConfig.h
trafficserver/traffic/trunk/proxy/mgmt2/api2/CoreAPI.cc
trafficserver/traffic/trunk/proxy/mgmt2/cli2/script_configs.sh
trafficserver/traffic/trunk/proxy/mgmt2/cli2/script_configs.tcl
trafficserver/traffic/trunk/proxy/mgmt2/cluster/ClusterCom.cc
trafficserver/traffic/trunk/proxy/mgmt2/cluster/ClusterCom.h
trafficserver/traffic/trunk/proxy/mgmt2/utils/Makefile.am
trafficserver/traffic/trunk/proxy/mgmt2/utils/MgmtSchema.cc
trafficserver/traffic/trunk/proxy/mgmt2/utils/WebMgmtUtils.cc
trafficserver/traffic/trunk/proxy/mgmt2/web2/WebHttp.cc
trafficserver/traffic/trunk/proxy/mgmt2/web2/WebIntrMain.cc
trafficserver/traffic/trunk/proxy/mgmt2/web2/WebReconfig.cc
trafficserver/traffic/trunk/proxy/stats/CoupledStats.h
trafficserver/traffic/trunk/rc/update_records.cc
Modified: trafficserver/traffic/trunk/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm (original)
+++ trafficserver/traffic/trunk/contrib/perl/AdminClient/lib/Apache/TS/AdminClient.pm Thu Dec 16 01:45:45 2010
@@ -603,11 +603,6 @@ The Apache Traffic Server Administration
proxy.config.proxy_binary
proxy.config.proxy_binary_opts
proxy.config.proxy_name
- proxy.config.raft.accept_port
- proxy.config.raft.enabled
- proxy.config.raft.proxy_version_max
- proxy.config.raft.proxy_version_min
- proxy.config.raft.server_port
proxy.config.remap.num_remap_threads
proxy.config.remap.use_remap_processor
proxy.config.res_track_memory
Modified: trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc Thu Dec 16 01:45:45 2010
@@ -401,17 +401,6 @@ HostDBProcessor::start(int)
IOCORE_EstablishStaticConfigInt32(hostdb_disable_reverse_lookup, "proxy.config.hostdb.disable_reverse_lookup");
IOCORE_EstablishStaticConfigInt32(hostdb_re_dns_on_reload, "proxy.config.hostdb.re_dns_on_reload");
IOCORE_EstablishStaticConfigInt32(hostdb_migrate_on_demand, "proxy.config.hostdb.migrate_on_demand");
- /* mgmt stuff
- int64_t ii = pmgmt->record_data->readConfigInteger(
- "proxy.config.hostdb.strict_round_robin", &found);
- if (found) {
- hostdb_strict_round_robin = (int32_t) ii;
- pmgmt->record_data->registerConfigUpdateFunc(
- "proxy.config.hostdb.strict_round_robin",config_int_cb,
- (void*)&hostdb_strict_round_robin);
- }
- */
-
IOCORE_EstablishStaticConfigInt32(hostdb_strict_round_robin, "proxy.config.hostdb.strict_round_robin");
IOCORE_EstablishStaticConfigInt32(hostdb_cluster, "proxy.config.hostdb.cluster");
IOCORE_EstablishStaticConfigInt32(hostdb_cluster_round_robin, "proxy.config.hostdb.cluster.round_robin");
Modified: trafficserver/traffic/trunk/lib/records/I_RecCore.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/records/I_RecCore.h?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/records/I_RecCore.h (original)
+++ trafficserver/traffic/trunk/lib/records/I_RecCore.h Thu Dec 16 01:45:45 2010
@@ -207,17 +207,11 @@ RecFloat REC_readFloat(char *name, bool
RecCounter REC_readCounter(char *name, bool * found, bool lock = true);
RecString REC_readString(const char *name, bool * found, bool lock = true);
-bool REC_setInteger(const char *name, RecInt value, bool dirty = true);
-bool REC_setFloat(const char *name, float value, bool dirty = true);
-bool REC_setCounter(const char *name, int64_t value, bool dirty = true);
-bool REC_setString(const char *name, char *value, bool dirty = true);
-
-
//------------------------------------------------------------------------
// Clear Statistics
//------------------------------------------------------------------------
int RecResetStatRecord(char *name);
-int RecResetStatRecord(RecT type = RECT_NULL);
+int RecResetStatRecord(RecT type = RECT_NULL, bool all = false);
//------------------------------------------------------------------------
Modified: trafficserver/traffic/trunk/lib/records/P_RecCore.i
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/records/P_RecCore.i?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/records/P_RecCore.i (original)
+++ trafficserver/traffic/trunk/lib/records/P_RecCore.i Thu Dec 16 01:45:45 2010
@@ -423,7 +423,6 @@ RecSetRecord(RecT rec_type, const char *
if ((data_type != RECD_NULL) && (r1->data_type != data_type)) {
err = REC_ERR_FAIL;
} else {
-
if (data_type == RECD_NULL) {
ink_assert(data->rec_string);
switch (r1->data_type) {
@@ -461,9 +460,7 @@ RecSetRecord(RecT rec_type, const char *
}
}
rec_mutex_release(&(r1->lock));
-
} else {
-
// We don't need to xstrdup() here as we will make copies of any
// strings when we marshal them into our RecMessage buffer.
RecRecord r2;
@@ -476,17 +473,13 @@ RecSetRecord(RecT rec_type, const char *
r2.stat_meta.data_raw = *data_raw;
}
err = send_set_message(&r2);
-
}
-
} else {
-
// Add the record but do not set the 'registered' flag, as this
// record really hasn't been registered yet. Also, in order to
// add the record, we need to have a rec_type, so if the user
// calls RecSetRecord on a record we haven't registered yet, we
// should fail out here.
-
if ((rec_type == RECT_NULL) || (data_type == RECD_NULL)) {
err = REC_ERR_FAIL;
goto Ldone;
@@ -998,7 +991,7 @@ RecResetStatRecord(char *name)
// RecResetStatRecord
//------------------------------------------------------------------------
int
-RecResetStatRecord(RecT type)
+RecResetStatRecord(RecT type, bool all)
{
int i, num_records;
int err = REC_ERR_OKAY;
@@ -1011,7 +1004,8 @@ RecResetStatRecord(RecT type)
if (REC_TYPE_IS_STAT(r1->rec_type) &&
((type == RECT_NULL) || (r1->rec_type == type)) &&
- (r1->stat_meta.persist_type != RECP_NON_PERSISTENT) && (r1->data_type != RECD_STRING)) {
+ (all || (r1->stat_meta.persist_type != RECP_NON_PERSISTENT)) &&
+ (r1->data_type != RECD_STRING)) {
if (i_am_the_record_owner(r1->rec_type)) {
rec_mutex_acquire(&(r1->lock));
if (!RecDataSet(r1->data_type, &(r1->data), &(r1->data_default))) {
Modified: trafficserver/traffic/trunk/lib/records/P_RecDefs.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/records/P_RecDefs.h?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/records/P_RecDefs.h (original)
+++ trafficserver/traffic/trunk/lib/records/P_RecDefs.h Thu Dec 16 01:45:45 2010
@@ -126,7 +126,7 @@ struct RecRecord
int rsb_id;
};
-// Used for cluster
+// Used for cluster. TODO: Do we still need this?
struct RecRecords
{
int num_recs;
Modified: trafficserver/traffic/trunk/lib/records/RecCore.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/records/RecCore.cc?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/records/RecCore.cc (original)
+++ trafficserver/traffic/trunk/lib/records/RecCore.cc Thu Dec 16 01:45:45 2010
@@ -208,11 +208,9 @@ RecCoreInit(RecModeT mode_type, Diags *_
// ./etc/trafficserver/records.config
// ./records.config
bool file_exists = true;
- g_rec_config_fpath = Layout::relative_to(Layout::get()->sysconfdir,
- REC_CONFIG_FILE REC_SHADOW_EXT);
+ g_rec_config_fpath = Layout::relative_to(Layout::get()->sysconfdir, REC_CONFIG_FILE REC_SHADOW_EXT);
if (RecFileExists(g_rec_config_fpath) == REC_ERR_FAIL) {
- g_rec_config_fpath = Layout::relative_to(Layout::get()->sysconfdir,
- REC_CONFIG_FILE);
+ g_rec_config_fpath = Layout::relative_to(Layout::get()->sysconfdir, REC_CONFIG_FILE);
if (RecFileExists(g_rec_config_fpath) == REC_ERR_FAIL) {
RecLog(DL_Warning, "Could not find '%s', system will run with defaults\n", REC_CONFIG_FILE);
file_exists = false;
@@ -997,7 +995,7 @@ RecGetRecordPrefix_Xmalloc(char *prefix,
//-------------------------------------------------------------------------
-// REC_ConfigReadInteger (backwards compatibility)
+// Backwards compatibility ... TODO: Should eliminate these
//-------------------------------------------------------------------------
RecInt
REC_ConfigReadInteger(const char *name)
@@ -1007,10 +1005,6 @@ REC_ConfigReadInteger(const char *name)
return t;
}
-
-//-------------------------------------------------------------------------
-// REC_ConfigReadString (backwards compatibility)
-//-------------------------------------------------------------------------
char *
REC_ConfigReadString(const char *name)
{
@@ -1019,10 +1013,6 @@ REC_ConfigReadString(const char *name)
return t;
}
-
-//-------------------------------------------------------------------------
-// REC_ConfigReadFloat (backwards compatibility)
-//-------------------------------------------------------------------------
RecFloat
REC_ConfigReadFloat(const char *name)
{
@@ -1031,10 +1021,6 @@ REC_ConfigReadFloat(const char *name)
return t;
}
-
-//-------------------------------------------------------------------------
-// REC_ConfigReadCounter (backwards compatibility)
-//-------------------------------------------------------------------------
RecCounter
REC_ConfigReadCounter(const char *name)
{
@@ -1045,7 +1031,7 @@ REC_ConfigReadCounter(const char *name)
//-------------------------------------------------------------------------
-// MGMT2 Marco (backwards compatibility)
+// Backwards compatibility. TODO: Should remove these.
//-------------------------------------------------------------------------
RecInt
REC_readInteger(const char *name, bool * found, bool lock)
@@ -1095,35 +1081,6 @@ REC_readString(const char *name, bool *
return _tmp;
}
-// MGMT2 Marco's -- converting lmgmt->record_data->setXXX
-bool
-REC_setInteger(const char *name, RecInt value, bool dirty)
-{
- REC_NOWARN_UNUSED(dirty);
- return RecSetRecordInt(name, value);
-}
-
-bool
-REC_setFloat(const char *name, float value, bool dirty)
-{
- REC_NOWARN_UNUSED(dirty);
- return RecSetRecordFloat(name, value);
-}
-
-bool
-REC_setCounter(const char *name, int64_t value, bool dirty)
-{
- REC_NOWARN_UNUSED(dirty);
- return RecSetRecordCounter(name, value);
-}
-
-bool
-REC_setString(const char *name, char *value, bool dirty)
-{
- REC_NOWARN_UNUSED(dirty);
- return RecSetRecordString(name, value);
-}
-
//-------------------------------------------------------------------------
// REC_SignalAlarm (TM) & REC_SignalManager (TS)
Modified: trafficserver/traffic/trunk/lib/ts/Diags.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/Diags.cc?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/Diags.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/Diags.cc Thu Dec 16 01:45:45 2010
@@ -42,7 +42,6 @@
#include "ink_time.h"
#include "ink_hrtime.h"
#include "Diags.h"
-//fixme #include "BaseRecords.h"
#include "Compatability.h"
Modified: trafficserver/traffic/trunk/proxy/Main.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Main.cc?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Main.cc (original)
+++ trafficserver/traffic/trunk/proxy/Main.cc Thu Dec 16 01:45:45 2010
@@ -458,8 +458,6 @@ init_dirs(void)
static void
initialize_process_manager()
{
- ProcessRecords *precs;
-
mgmt_use_syslog();
// Temporary Hack to Enable Communuication with LocalManager
@@ -470,8 +468,7 @@ initialize_process_manager()
if (access(management_directory, R_OK) == -1) {
ink_strncpy(management_directory, Layout::get()->sysconfdir, PATH_NAME_MAX);
if (access(management_directory, R_OK) == -1) {
- fprintf(stderr,"unable to access() management path '%s': %d, %s\n",
- management_directory, errno, strerror(errno));
+ fprintf(stderr,"unable to access() management path '%s': %d, %s\n", management_directory, errno, strerror(errno));
fprintf(stderr,"please set management path via command line '-d <managment directory>'\n");
_exit(1);
}
@@ -485,36 +482,23 @@ initialize_process_manager()
//
// Start up manager
//
- //precs = NEW (new ProcessRecords(management_directory,"records.config","lm.config"));
- precs = NEW(new ProcessRecords(management_directory, "records.config", 0));
-
- pmgmt = NEW(new ProcessManager(remote_management_flag, management_directory, precs));
+ pmgmt = NEW(new ProcessManager(remote_management_flag, management_directory));
pmgmt->start();
-
RecProcessInitMessage(remote_management_flag ? RECM_CLIENT : RECM_STAND_ALONE);
-
pmgmt->reconfigure();
-
init_dirs();// setup directories
//
// Define version info records
//
RecRegisterStatString(RECT_PROCESS, "proxy.process.version.server.short", appVersionInfo.VersionStr, RECP_NULL);
- RecRegisterStatString(RECT_PROCESS,
- "proxy.process.version.server.long", appVersionInfo.FullVersionInfoStr, RECP_NULL);
+ RecRegisterStatString(RECT_PROCESS, "proxy.process.version.server.long", appVersionInfo.FullVersionInfoStr, RECP_NULL);
RecRegisterStatString(RECT_PROCESS, "proxy.process.version.server.build_number", appVersionInfo.BldNumStr, RECP_NULL);
RecRegisterStatString(RECT_PROCESS, "proxy.process.version.server.build_time", appVersionInfo.BldTimeStr, RECP_NULL);
RecRegisterStatString(RECT_PROCESS, "proxy.process.version.server.build_date", appVersionInfo.BldDateStr, RECP_NULL);
- RecRegisterStatString(RECT_PROCESS,
- "proxy.process.version.server.build_machine", appVersionInfo.BldMachineStr, RECP_NULL);
- RecRegisterStatString(RECT_PROCESS,
- "proxy.process.version.server.build_person", appVersionInfo.BldPersonStr, RECP_NULL);
- // RecRegisterStatString(RECT_PROCESS,
- // "proxy.process.version.server.build_compile_flags",
- // appVersionInfo.BldCompileFlagsStr,
- // RECP_NULL);
+ RecRegisterStatString(RECT_PROCESS, "proxy.process.version.server.build_machine", appVersionInfo.BldMachineStr, RECP_NULL);
+ RecRegisterStatString(RECT_PROCESS, "proxy.process.version.server.build_person", appVersionInfo.BldPersonStr, RECP_NULL);
}
//
@@ -1667,8 +1651,7 @@ main(int argc, char **argv)
check_system_constants();
// Define the version info
- appVersionInfo.setup(PACKAGE_NAME,"traffic_server", PACKAGE_VERSION, __DATE__,
- __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
+ appVersionInfo.setup(PACKAGE_NAME,"traffic_server", PACKAGE_VERSION, __DATE__, __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
// Before accessing file system initialize Layout engine
Layout::create();
@@ -1698,8 +1681,6 @@ main(int argc, char **argv)
// yet we do not know where
openlog("traffic_server", LOG_PID | LOG_NDELAY | LOG_NOWAIT, LOG_DAEMON);
-
-
// Setup Diags temporary to allow librecords to be initialized.
// We will re-configure Diags again with proper configurations after
// librecords initialized. This is needed because:
@@ -1721,7 +1702,6 @@ main(int argc, char **argv)
// Set the core limit for the process
init_core_size();
-
init_system();
// Adjust system and process settings
Modified: trafficserver/traffic/trunk/proxy/ProxyConfig.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/ProxyConfig.h?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/ProxyConfig.h (original)
+++ trafficserver/traffic/trunk/proxy/ProxyConfig.h Thu Dec 16 01:45:45 2010
@@ -42,261 +42,8 @@ void *config_string511_cb(void *data, vo
void *config_string_alloc_cb(void *data, void *value);
//
-// Syntactic sugar for management record access
-//
-#define LIBRECORDS_WARN \
-Warning("** MUST MIGRATE TO LIBRECORDS ** file:%s line:%d\n", __FILE__, __LINE__)
-
-#define ConfigReadCounter(_s) pmgmt->record_data->readConfigCounter(_s); LIBRECORDS_WARN
-#define ConfigReadInteger(_s) pmgmt->record_data->readConfigInteger(_s); LIBRECORDS_WARN
-#define ConfigReadFloat(_s) pmgmt->record_data->readConfigFloat(_s); LIBRECORDS_WARN
-#define ConfigReadString(_s) pmgmt->record_data->readConfigString(_s); LIBRECORDS_WARN
-#define LocalReadInteger(_s) pmgmt->record_data->readLocalInteger(_s); LIBRECORDS_WARN
-
-//
// Macros that spin waiting for the data to be bound
//
-
-#define ReadConfigStringAlloc(_s,_sc) do { \
- LIBRECORDS_WARN; \
- bool _found = 0; int _len = -1; \
- char * _ss = pmgmt->record_data->readConfigString(_sc, &_found); \
- if (_found) { \
- if (_ss) { _len = strlen(_ss); \
- _s = (char *)xmalloc(_len+1); \
- memcpy(_s, _ss, _len+1); xfree(_ss); } \
- } else { Warning("Cannot read config %s",_sc); } \
-} while(0)
-
-#define ReadConfigString(_s,_sc,_len) do { \
- LIBRECORDS_WARN; \
- bool _found = 0; \
- char * _ss = pmgmt->record_data->readConfigString(_sc, &_found); \
- if (_found && _ss) { strncpy(_s,_ss,_len); xfree(_ss); } \
- else Warning("Cannot read config %s",_sc); \
-} while(0)
-
-#define ReadConfigInteger(_i,_s) do { \
- LIBRECORDS_WARN; \
- bool _found = 0; \
- int64_t _ii = pmgmt->record_data->readConfigInteger(_s, &_found); \
- if (_found) _i = _ii; else Warning("Cannot read config %s",_s); \
-} while(0)
-
-#define ReadConfigInt32(_i,_s) do { \
- LIBRECORDS_WARN; \
- bool _found = 0; \
- int64_t _ii = pmgmt->record_data->readConfigInteger(_s, &_found); \
- if (_found) _i = (int32_t)_ii; else Warning("Cannot read config %s",_s); \
-} while(0)
-
-#define ReadConfigInt32U(_i,_s) do { \
- LIBRECORDS_WARN; \
- bool _found = 0; \
- int64_t _ii = pmgmt->record_data->readConfigInteger(_s, &_found); \
- if (_found) _i = (uint32_t)_ii; else Warning("Cannot read config %s",_s); \
-} while(0)
-
-#define ReadConfigFloat(_f,_s) do { \
- LIBRECORDS_WARN; \
- bool _found = 0; \
- float _ff = pmgmt->record_data->readConfigFloat(_s, &_found); \
- if (_found) _f = _ff; else Warning("Cannot read config %s",_s); \
-} while(0)
-
-#define ReadLocalInteger(_i,_s) do { \
- LIBRECORDS_WARN; \
- bool _found = 0; \
- int64_t _ii = pmgmt->record_data->readLocalInteger(_s, &_found); \
- if (_found) _i = _ii; else Warning("Cannot read config %s",_s); \
-} while(0)
-
-//
-// Syntactic sugar for management record access
-//
-#ifdef DEBUG
-#define RegisterStatUpdateFunc(_n,_cb,_odata) \
-do { \
- LIBRECORDS_WARN; \
- ink_assert(pmgmt->record_data->registerStatUpdateFunc(_n,_cb,_odata)); \
-} while(0)
-
-#define RegisterConfigUpdateFunc(_n,_cb,_odata) \
-do { \
- LIBRECORDS_WARN; \
- ink_assert(pmgmt->record_data->registerConfigUpdateFunc(_n,_cb,_odata)); \
-} while(0)
-
-#define RegisterConfigUpdateFuncInteger(_i,_n) \
-do { \
- LIBRECORDS_WARN; \
- int* tmp_ptr = &_i; \
- ink_assert(pmgmt->record_data->registerConfigUpdateFunc(_n,config_int_cb, (void*)tmp_ptr)); \
-} while(0)
-
-#define RegisterConfigUpdateFuncIntegerU(_i,_n) \
-do { \
- LIBRECORDS_WARN; \
- unsigned* tmp_ptr = &_i; \
- ink_assert(pmgmt->record_data->registerConfigUpdateFunc(_n,config_int_cb, (void*)tmp_ptr)); \
-} while(0)
-
-#define RegisterConfigUpdateFuncFloat(_i,_n) \
-do { \
- LIBRECORDS_WARN; \
- ink_assert(pmgmt->record_data->registerConfigUpdateFunc(_n,config_float_cb, (void*)&_i));\
-} while(0)
-
-#define RegisterConfigUpdateFuncLongLong(_ll,_n) \
-do { \
- LIBRECORDS_WARN; \
- int64_t* tmp_ptr = &_ll; \
- ink_assert(pmgmt->record_data->registerConfigUpdateFunc(_n,config_long_long_cb, (void*)tmp_ptr));\
-} while(0)
-
-#define RegisterConfigUpdateFuncInt64(_ll,_n) \
-RegisterConfigUpdateFuncLongLong(_ll,_n)
-
-#define RegisterConfigUpdateFuncStringAlloc(_ll,_n) \
-do { \
- LIBRECORDS_WARN; \
- ink_assert(pmgmt->record_data->registerConfigUpdateFunc(_n,config_string_alloc_cb, (void*)&_ll)); \
-} while(0)
-
-#define RegisterLocalUpdateFunc(_n,_cb,_odata) \
-do { \
- LIBRECORDS_WARN; \
- ink_assert(pmgmt->record_data->registerLocalUpdateFunc(_n,_cb,_odata)); \
-} while (0)
-
-#define RegisterLocalUpdateFuncInteger(_i,_n) \
-do { \
- LIBRECORDS_WARN; \
- int* tmp_ptr = &_i; \
- ink_assert(pmgmt->record_data->registerLocalUpdateFunc(_n,config_int_cb, (void*)tmp_ptr)); \
-} while(0)
-
-#else
-
-#define RegisterStatUpdateFunc(_n,_cb,_odata) \
-do { \
- LIBRECORDS_WARN; \
- pmgmt->record_data->registerStatUpdateFunc(_n,_cb,_odata); \
-} while(0)
-
-#define RegisterConfigUpdateFunc(_n,_cb,_odata) \
-do { \
- LIBRECORDS_WARN; \
- pmgmt->record_data->registerConfigUpdateFunc(_n,_cb,_odata); \
-} while(0)
-
-#define RegisterConfigUpdateFuncInteger(_i,_n) \
-do { \
- LIBRECORDS_WARN; \
- pmgmt->record_data->registerConfigUpdateFunc(_n,config_int_cb, (void*)&_i); \
-} while(0)
-
-#define RegisterConfigUpdateFuncIntegerU(_i,_n) \
-do { \
- LIBRECORDS_WARN; \
- pmgmt->record_data->registerConfigUpdateFunc(_n,config_int_cb, (void*)&_i); \
-} while(0)
-
-#define RegisterConfigUpdateFuncFloat(_i,_n) \
-do { \
- LIBRECORDS_WARN; \
- pmgmt->record_data->registerConfigUpdateFunc(_n,config_float_cb, (void*)&_i); \
-} while(0)
-
-#define RegisterConfigUpdateFuncLongLong(_ll,_n) \
-do { \
- LIBRECORDS_WARN; \
- pmgmt->record_data->registerConfigUpdateFunc(_n,config_long_long_cb, (void*)&_ll); \
-} while(0)
-
-#define RegisterConfigUpdateFuncInt64(_ll,_n) \
-RegisterConfigUpdateFuncLongLong(_ll,_n)
-
-#define RegisterConfigUpdateFuncStringAlloc(_ll,_n) \
-do { \
- LIBRECORDS_WARN; \
- pmgmt->record_data->registerConfigUpdateFunc(_n,config_string_alloc_cb, (void*)&_ll); \
-} while(0)
-
-#define RegisterLocalUpdateFunc(_n,_cb,_odata) \
-do { \
- LIBRECORDS_WARN; \
- pmgmt->record_data->registerLocalUpdateFunc(_n,_cb,_odata); \
-} while(0)
-
-#define RegisterLocalUpdateFuncInteger(_i,_n) \
-do { \
- LIBRECORDS_WARN; \
- pmgmt->record_data->registerLocalUpdateFunc(_n,config_int_cb, (void*)&_i); \
-} while(0)
-
-#endif
-
-#define EstablishStaticConfigInteger(_ix,_n) \
-ReadConfigInteger(_ix,_n); \
-RegisterConfigUpdateFuncInteger(_ix,_n)
-
-#define EstablishStaticConfigInt32(_ix,_n) \
-ReadConfigInt32(_ix,_n); \
-RegisterConfigUpdateFuncInteger(_ix,_n)
-
-#define EstablishStaticConfigIntegerU(_ix,_n) \
-ReadConfigInteger(_ix,_n); \
-RegisterConfigUpdateFuncIntegerU(_ix,_n)
-
-#define EstablishStaticConfigInt32U(_ix,_n) \
-ReadConfigInt32U(_ix,_n); \
-RegisterConfigUpdateFuncIntegerU(_ix,_n)
-
-#define EstablishStaticConfigFloat(_ix,_n) \
-ReadConfigFloat(_ix,_n); \
-RegisterConfigUpdateFuncFloat(_ix,_n)
-
-#define EstablishStaticConfigLongLong(_ix,_n) \
-ReadConfigInteger(_ix,_n); \
-RegisterConfigUpdateFuncLongLong(_ix,_n)
-
-#define EstablishStaticConfigInt64(_ix,_n) \
-ReadConfigInteger(_ix,_n); \
-RegisterConfigUpdateFuncInt64(_ix,_n)
-
-#define EstablishStaticConfigStringAlloc(_ix,_n) \
-ReadConfigStringAlloc(_ix,_n); \
-RegisterConfigUpdateFuncStringAlloc(_ix,_n)
-
-#define EstablishStaticLocalInteger(_ix,_n) \
-ReadLocalInteger(_ix,_n); \
-RegisterLocalUpdateFuncInteger(_ix,_n)
-
-#define RegisterStatCountSum(_n) \
- RegisterStatUpdateFunc( "proxy.process." #_n ".sum", stats_sum_cb, \
- (void*)_n##_Stat); \
- RegisterStatUpdateFunc( "proxy.process." #_n ".count", stats_count_cb, \
- (void*)_n##_Stat)
-
-#define RegisterStatCountFSum(_n) \
- RegisterStatUpdateFunc( "proxy.process." #_n ".sum", stats_fsum_cb, \
- (void*)_n##_Stat); \
- RegisterStatUpdateFunc( "proxy.process." #_n ".count", stats_count_cb, \
- (void*)_n##_Stat)
-
-#define RegisterStatSum(_n) \
- RegisterStatUpdateFunc( "proxy.process." #_n, stats_sum_cb, \
- (void*)_n##_Stat)
-
-#define RegisterStatCount(_n) \
- RegisterStatUpdateFunc( "proxy.process." #_n, stats_count_cb, \
- (void*)_n##_Stat)
-
-#define RegisterStatAvg(_n) \
- RegisterStatUpdateFunc( "proxy.process." #_n, stats_avg_cb, \
- (void*)_n##_Stat)
-
#define SignalManager(_n,_d) pmgmt->signalManager(_n,(char*)_d)
#define SignalWarning(_n,_s) { Warning(_s); SignalManager(_n,_s); }
Modified: trafficserver/traffic/trunk/proxy/StatSystem.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/StatSystem.cc?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/StatSystem.cc (original)
+++ trafficserver/traffic/trunk/proxy/StatSystem.cc Thu Dec 16 01:45:45 2010
@@ -30,12 +30,10 @@
#include "StatSystem.h"
#include "P_EventSystem.h"
#include "Error.h"
-#include "BaseRecords.h"
#include "ProcessManager.h"
#include "ProxyConfig.h"
#include "StatPages.h"
#include "HTTP.h"
-#include "RecordsConfig.h"
#include "I_Layout.h"
// defines
@@ -397,11 +395,6 @@ start_stats_snap()
Warning("disabling statistics snap");
}
-
-
-static const char **stat_names = NULL;
-static int nstat_names = 0;
-
static Action *
stat_callback(Continuation * cont, HTTPHdr * header)
{
@@ -459,43 +452,6 @@ stat_callback(Continuation * cont, HTTPH
return ACTION_RESULT_DONE;
}
-static void
-stat_callback_init()
-{
-
- const char *p;
- int i, j;
-
- statPagesManager.register_http("stat", stat_callback);
-
- nstat_names = 0;
- for (i = 0; RecordsConfig[i].value_type != INVALID; i++) {
- //if (RecordsConfig[i].type == PROCESS || RecordsConfig[i].type == NODE) {
- nstat_names++;
- //}
- }
- stat_names = (const char **) xmalloc(nstat_names * sizeof(char *));
-
- j = 0;
- for (i = 0; RecordsConfig[i].value_type != INVALID; i++) {
- //if (RecordsConfig[i].type == PROCESS || RecordsConfig[i].type == NODE) {
- stat_names[j] = RecordsConfig[i].name;
- j++;
- //}
- }
-
- for (i = 1; i < nstat_names; i++) {
- j = i;
- p = stat_names[j];
- while ((j > 0) && (strcmp(p, stat_names[j - 1]) < 0)) {
- stat_names[j] = stat_names[j - 1];
- j -= 1;
- }
- stat_names[j] = p;
- }
-
-}
-
static Action *
testpage_callback(Continuation * cont, HTTPHdr *)
{
@@ -550,7 +506,8 @@ initialize_all_global_stats()
local_state_dir, snap_file);
Debug("stats", "stat snap filename %s", snap_filename);
- stat_callback_init();
+ statPagesManager.register_http("stat", stat_callback);
+
testpage_callback_init();
read_stats_snap();
@@ -573,36 +530,39 @@ initialize_all_global_stats()
}
}
- pmgmt->record_data->registerUpdateLockFunc(tmp_stats_lock_function);
+ // TODO: HMMMM, wtf does this do? The following is that this
+ // function does:
+ // ink_atomic_swap_ptr(&this->f_update_lock, (void *) func)
+ //
+ // pmgmt->record_data->registerUpdateLockFunc(tmp_stats_lock_function);
#ifdef DEBUG
ink_mutex_init(&http_time_lock, "Http Time Function Lock");
last_http_local_time = 0;
#endif
- initialize_http_stats();
- initialize_cache_stats();
-}
-
-void *
-tmp_stats_lock_function(UpdateLockAction action)
-{
- stats_lock_function((void *) (&global_http_trans_stat_lock), action);
-
- return NULL;
+ clear_http_handler_times();
}
-void *
-stats_lock_function(void *data, UpdateLockAction action)
-{
- if (action == UPDATE_LOCK_ACQUIRE) {
- STAT_LOCK_ACQUIRE((ink_stat_lock_t *) data);
- } else {
- STAT_LOCK_RELEASE((ink_stat_lock_t *) data);
- }
+//void *
+//tmp_stats_lock_function(UpdateLockAction action)
+//{
+// stats_lock_function((void *) (&global_http_trans_stat_lock), action);
+//
+// return NULL;
+//}
- return NULL;
-}
+//void *
+//stats_lock_function(void *data, UpdateLockAction action)
+//{
+// if (action == UPDATE_LOCK_ACQUIRE) {
+// STAT_LOCK_ACQUIRE((ink_stat_lock_t *) data);
+// } else {
+// STAT_LOCK_RELEASE((ink_stat_lock_t *) data);
+// }
+//
+// return NULL;
+//}
void *
dyn_stats_int_msecs_to_float_seconds_cb(void *data, void *res)
@@ -845,52 +805,6 @@ http_trans_stats_time_useconds_cb(void *
return res;
}
-
-void
-initialize_http_stats()
-{
- ///////////////////////
- // Transaction Stats //
- ///////////////////////
-
- ///////////////////
- // Dynamic stats //
- ///////////////////
- ////////////////////////////////////////////////////////////////////////////////
- // http - time and count of transactions classified by client's point of view //
- // the internal stat is in msecs, the output time is float seconds //
- ////////////////////////////////////////////////////////////////////////////////
-
-
-
-
- clear_http_handler_times();
-}
-
-
-void
-initialize_cache_stats()
-{
-
-#ifdef TS_MICRO
- pmgmt->record_data->registerStatUpdateFunc("proxy.process.stuffer.total_promises",
- dyn_stats_count_cb, (void *) stuffer_total_promises);
- pmgmt->record_data->registerStatUpdateFunc("proxy.process.stuffer.total_objects",
- dyn_stats_count_cb, (void *) stuffer_total_objects);
- pmgmt->record_data->registerStatUpdateFunc("proxy.process.stuffer.total_bytes_received",
- dyn_stats_count_cb, (void *) stuffer_total_bytes_received);
- pmgmt->record_data->registerStatUpdateFunc("proxy.process.stuffer.open_read_blocks",
- dyn_stats_count_cb, (void *) stuffer_open_read_blocks);
- pmgmt->record_data->registerStatUpdateFunc("proxy.process.stuffer.ram_cache_hits",
- dyn_stats_count_cb, (void *) stuffer_ram_cache_hits);
- pmgmt->record_data->registerStatUpdateFunc("proxy.process.stuffer.url_lookup_misses",
- dyn_stats_count_cb, (void *) stuffer_url_lookup_misses);
- pmgmt->record_data->registerStatUpdateFunc("proxy.process.stuffer.total_objects_pushed",
- dyn_stats_count_cb, (void *) stuffer_total_objects_pushed);
-#endif
-
-}
-
//////////////////////////////////////////////////////////////////////////////
//
// TransactionMilestones::TransactionMilestones()
@@ -913,105 +827,3 @@ ua_begin(0), ua_read_header_done(0), ua_
{
return;
}
-
-#ifdef DEBUG
-bool
-TransactionMilestones::invariant()
-{
- /*
- bool must_times_set = true;
- bool order_correct = true;
-
- #define PRINT_COND(cond) { fprintf(stderr,"internal ivry conflict: %s (%s:%d)\n", #cond, __FILE__, __LINE__); }
- #define UNSET_IF_FAILS(v, cond) if (!(cond)) { PRINT_COND(cond); v = false; }
- #define UIF(v, cond) UNSET_IF_FAILS(v, cond);
-
- UIF(must_times_set, (user_agent_begin != 0));
- UIF(must_times_set, (user_agent_begin_read != 0));
- UIF(must_times_set, (user_agent_read_header_done != 0));
- UIF(must_times_set, (user_agent_close != 0));
- UIF(must_times_set, (state_machine_construct != 0));
- UIF(must_times_set, (state_machine_destruct != 0));
-
- /////////////////
- // check order //
- /////////////////
- ///////////////////////////
- // user agent milestones //
- ///////////////////////////
- UIF(order_correct,
- ((user_agent_accept <= user_agent_begin_read) || (user_agent_accept == 0)));
- UIF(order_correct, (user_agent_begin_read <= user_agent_read_header_done));
- UIF(order_correct,
- ((user_agent_read_header_done <= user_agent_begin_write) ||
- (user_agent_begin_write == 0)));
- UIF(order_correct, (user_agent_read_header_done <= user_agent_close));
- UIF(order_correct,
- ((user_agent_begin_write <= user_agent_close) || (user_agent_begin_write == 0)));
- /////////////////////////////////
- // user agent -- data sources //
- /////////////////////////////////
- UIF(order_correct,
- ((user_agent_begin <= origin_server_open_begin) ||
- (origin_server_open_begin == 0)));
- UIF(order_correct,
- ((user_agent_begin <= raw_origin_server_connect_begin) ||
- (raw_origin_server_connect_begin == 0)));
- UIF(order_correct,
- ((user_agent_begin <= cache_lookup_begin) || (cache_lookup_begin == 0)));
- UIF(order_correct,
- ((user_agent_begin <= transform_open_begin) || (transform_open_begin == 0)));
- ///////////////////
- // origin server //
- ///////////////////
- UIF(order_correct, (origin_server_open_begin <= origin_server_open_end));
- UIF(order_correct,
- ((origin_server_open_end <= origin_server_begin_write) ||
- (origin_server_begin_write == 0)));
- UIF(order_correct,
- ((origin_server_open_end <= origin_server_begin_read) ||
- (origin_server_begin_read == 0)));
-
- UIF(order_correct, (origin_server_open_end <= origin_server_close));
- UIF(order_correct, (origin_server_begin_read <= origin_server_read_header_done));
- ///////////////////////
- // raw origin server //
- ///////////////////////
- UIF(order_correct, (raw_origin_server_connect_begin <= raw_origin_server_connect_end));
- UIF(order_correct, (raw_origin_server_connect_end <= raw_origin_server_begin_read_write));
- UIF(order_correct, (raw_origin_server_connect_end <= raw_origin_server_close));
- ///////////
- // cache //
- ///////////
- UIF(order_correct, ((cache_lookup_begin <= cache_lookup_end) || (cache_lookup_end == 0)));
- UIF(order_correct, ((cache_lookup_end <= cache_update_begin) || (cache_update_begin == 0)));
- UIF(order_correct, (cache_update_begin <= cache_update_end));
- UIF(order_correct, ((cache_lookup_end <= cache_open_read_begin) ||
- (cache_open_read_begin == 0)));
- UIF(order_correct, ((cache_lookup_end <= cache_open_write_begin) ||
- (cache_open_write_begin == 0)));
- UIF(order_correct, (cache_open_read_begin <= cache_open_read_end));
- UIF(order_correct, (cache_open_write_begin <= cache_open_write_end));
- UIF(order_correct, ((cache_open_read_end <= cache_read_begin) ||
- (cache_read_begin == 0)));
- UIF(order_correct, ((cache_open_write_end <= cache_write_begin) ||
- (cache_write_begin == 0)));
- UIF(order_correct, (cache_read_begin <= cache_read_end));
- UIF(order_correct, (cache_write_begin <= cache_write_end));
- ///////////////////
- // transform JG //
- ///////////////////
- UIF(order_correct, (transform_open_begin <= transform_open_end));
- UIF(order_correct, ((transform_open_end <= transform_close) || (transform_close == 0)));
- ///////////////////
- // state machine //
- ///////////////////
- UIF(order_correct, (state_machine_construct <= state_machine_destruct));
-
- return (must_times_set && order_correct);
- */
-
- return true;
-}
-
-#endif
Modified: trafficserver/traffic/trunk/proxy/StatSystem.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/StatSystem.h?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/StatSystem.h (original)
+++ trafficserver/traffic/trunk/proxy/StatSystem.h Thu Dec 16 01:45:45 2010
@@ -32,7 +32,6 @@
#include "ink_platform.h"
#include "ink_hrtime.h"
#include "ink_atomic.h"
-#include "BaseRecords.h"
#ifdef USE_LOCKS_FOR_DYN_STATS
#include "Lock.h"
#endif
@@ -631,10 +630,10 @@ global_dyn_stats[X].sum = S
//---------------------------------------------------------------------//
extern void start_stats_snap(void);
void initialize_all_global_stats();
-void initialize_http_stats();
-void initialize_cache_stats();
-void *tmp_stats_lock_function(UpdateLockAction action);
-void *stats_lock_function(void *data, UpdateLockAction action);
+
+// TODO: I don't think these are necessary any more, but double check.
+//void *tmp_stats_lock_function(UpdateLockAction action);
+//void *stats_lock_function(void *data, UpdateLockAction action);
void *http_trans_stats_count_cb(void *data, void *res);
void *http_trans_stats_sum_cb(void *data, void *res);
Modified: trafficserver/traffic/trunk/proxy/http2/HttpTransact.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpTransact.h?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpTransact.h (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpTransact.h Thu Dec 16 01:45:45 2010
@@ -35,7 +35,6 @@
#include "ControlMatcher.h"
#include "CacheControl.h"
#include "ParentSelection.h"
-#include "BaseRecords.h"
#include "ProxyConfig.h"
#include "Transform.h"
//#include "HttpAuthParams.h"
Modified: trafficserver/traffic/trunk/proxy/logging/LogStandalone.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogStandalone.cc?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogStandalone.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogStandalone.cc Thu Dec 16 01:45:45 2010
@@ -39,6 +39,7 @@
#include "ProcessManager.h"
#include "MgmtUtils.h"
+// Needs LibRecordsConfigInit()
#include "RecordsConfig.h"
#define LOG_ReadConfigString REC_ReadConfigString
@@ -124,8 +125,6 @@ init_system()
static void
initialize_process_manager()
{
- ProcessRecords *precs;
-
mgmt_use_syslog();
// Temporary Hack to Enable Communuication with LocalManager
@@ -153,11 +152,7 @@ initialize_process_manager()
}
//
// Start up manager
- //
- // precs = NEW (new ProcessRecords(management_directory,
- // "records.config","lm.config"));
- precs = NEW(new ProcessRecords(management_directory, "records.config", NULL));
- pmgmt = NEW(new ProcessManager(remote_management_flag, management_directory, precs));
+ pmgmt = NEW(new ProcessManager(remote_management_flag, management_directory));
pmgmt->start();
Modified: trafficserver/traffic/trunk/proxy/mgmt2/FileManager.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/FileManager.cc?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/FileManager.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/FileManager.cc Thu Dec 16 01:45:45 2010
@@ -770,7 +770,7 @@ FileManager::WalkSnaps(ExpandingArray *
snapshot_dir = new char[snapshot_dir_size];
ink_assert(snapshot_dir);
snprintf(snapshot_dir, snapshot_dir_size, "%s", "snapshots");
- REC_setString("proxy.config.snapshot_dir", snapshot_dir);
+ RecSetRecordString("proxy.config.snapshot_dir", snapshot_dir);
}
//if(strncmp(snapshot_dir, config_dir, strlen(config_dir)))
if (snapshot_dir[0] != '/')
Modified: trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.cc?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.cc Thu Dec 16 01:45:45 2010
@@ -231,8 +231,8 @@ LocalManager::processRunning()
}
} /* End LocalManager::processRunning */
-LocalManager::LocalManager(char *mpath, LMRecords * rd, bool proxy_on):
-BaseManager(), run_proxy(proxy_on), record_data(rd)
+LocalManager::LocalManager(char *mpath, bool proxy_on)
+ : BaseManager(), run_proxy(proxy_on)
{
NOWARN_UNUSED(mpath);
bool found;
@@ -247,7 +247,7 @@ BaseManager(), run_proxy(proxy_on), reco
proxy_launch_outstanding = false;
mgmt_shutdown_outstanding = false;
proxy_running = 0;
- REC_setInteger("proxy.node.proxy_running", 0);
+ RecSetRecordInt("proxy.node.proxy_running", 0);
mgmt_sync_key = REC_readInteger("proxy.config.lm.sem_id", &found);
if (!found || mgmt_sync_key <= 0) {
mgmt_log("Bad or missing proxy.config.lm.sem_id value; using default id %d\n", MGMT_SEMID_DEFAULT);
@@ -521,7 +521,7 @@ LocalManager::initMgmtProcessServer()
mgmt_fatal(stderr, "[LocalManager::initMgmtProcessServer] Unable to listen on socket exiting\n");
}
- REC_setInteger("proxy.node.restarts.manager.start_time", manager_started_at);
+ RecSetRecordInt("proxy.node.restarts.manager.start_time", manager_started_at);
} /* End LocalManager::initMgmtProcessServer */
/*
@@ -635,9 +635,6 @@ LocalManager::pollMgmtProcessServer()
"Server Process terminated due to Sig %d: %s\n", sig, strsignal(sig));
}
-// watched_process_fd = watched_process_pid = -1;
- // record_data->removeExternalRecords(PROCESS, watched_process_pid);
-
if (lmgmt->run_proxy) {
mgmt_elog("[Alarms::signalAlarm] Server Process was reset\n");
lmgmt->alarm_keeper->signalAlarm(MGMT_ALARM_PROXY_PROCESS_DIED);
@@ -650,7 +647,7 @@ LocalManager::pollMgmtProcessServer()
proxy_running--;
}
proxy_started_at = -1;
- REC_setInteger("proxy.node.proxy_running", 0);
+ RecSetRecordInt("proxy.node.proxy_running", 0);
}
num--;
@@ -679,7 +676,7 @@ LocalManager::handleMgmtMsgFromProcesses
proxy_running++;
proxy_launch_pid = -1;
proxy_launch_outstanding = false;
- REC_setInteger("proxy.node.proxy_running", 1);
+ RecSetRecordInt("proxy.node.proxy_running", 1);
break;
case MGMT_SIGNAL_MACHINE_UP:
@@ -781,7 +778,7 @@ LocalManager::handleMgmtMsgFromProcesses
}
switch (stype) {
case INK_INT:
- REC_setInteger(var_name, ink_atoi64(var_value));
+ RecSetRecordInt(var_name, ink_atoi64(var_value));
break;
case INK_COUNTER:
case INK_FLOAT:
@@ -957,7 +954,7 @@ LocalManager::sendMgmtMsgToProcesses(Mgm
proxy_running--;
}
proxy_started_at = -1;
- REC_setInteger("proxy.node.proxy_running", 0);
+ RecSetRecordInt("proxy.node.proxy_running", 0);
// End of TS down
} else {
// TS is still up, but the connection is lost
@@ -1021,11 +1018,9 @@ LocalManager::signalEvent(int msg_id, co
void
LocalManager::processEventQueue()
{
-
bool handled_by_mgmt;
while (!queue_is_empty(mgmt_event_queue)) {
-
handled_by_mgmt = false;
MgmtMessageHdr *mh = (MgmtMessageHdr *) dequeue(mgmt_event_queue);
@@ -1062,7 +1057,6 @@ LocalManager::processEventQueue()
}
xfree(mh);
-
}
} /* End LocalManager::processEventQueue */
@@ -1136,8 +1130,8 @@ LocalManager::startProxy()
proxy_launch_outstanding = true;
proxy_started_at = time(NULL);
++proxy_launch_count;
- REC_setInteger("proxy.node.restarts.proxy.start_time", proxy_started_at);
- REC_setInteger("proxy.node.restarts.proxy.restart_count", proxy_launch_count);
+ RecSetRecordInt("proxy.node.restarts.proxy.start_time", proxy_started_at);
+ RecSetRecordInt("proxy.node.restarts.proxy.restart_count", proxy_launch_count);
} else {
int res, i = 0, n;
char real_proxy_options[2048], *options[32], *last, *tok;
Modified: trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.h?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.h (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.h Thu Dec 16 01:45:45 2010
@@ -36,7 +36,6 @@
#include "Main.h"
#include "Alarms.h"
-#include "LMRecords.h"
#include "BaseManager.h"
#include "ClusterCom.h"
#include "VMap.h"
@@ -50,17 +49,13 @@
#define ink_get_based_hrtime ink_get_based_hrtime_internal
#endif
-extern LocalManager *lmgmt;
-
-class LocalManager:public BaseManager
+class LocalManager: public BaseManager
{
-
public:
+ LocalManager(char *mpath, bool proxy_on);
- LocalManager(char *mpath, LMRecords * rd, bool proxy_on);
- ~LocalManager()
+ ~LocalManager()
{
- delete record_data;
delete alarm_keeper;
delete virt_map;
delete ccom;
@@ -178,8 +173,6 @@ public:
volatile int internal_ticker;
volatile pid_t watched_process_pid;
- LMRecords *record_data;
-
#ifdef MGMT_USE_SYSLOG
int syslog_facility;
#endif
@@ -189,9 +182,10 @@ public:
wccp::Cache wccp_cache;
# endif
private:
-
}; /* End class LocalManager */
+extern LocalManager *lmgmt;
+
#if TS_USE_POSIX_CAP
bool elevateFileAccess(bool);
#else
Modified: trafficserver/traffic/trunk/proxy/mgmt2/Main.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/Main.cc?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/Main.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/Main.cc Thu Dec 16 01:45:45 2010
@@ -36,7 +36,6 @@
#include "Main.h"
#include "MgmtUtils.h"
#include "MgmtSchema.h"
-#include "MgmtConverter.h"
#include "WebMgmtUtils.h"
#include "WebIntrMain.h"
#include "WebOverview.h"
@@ -51,6 +50,8 @@
#include "URL.h"
#include "MIME.h"
#include "HTTP.h"
+
+// Needs LibRecordsConfigInit()
#include "RecordsConfig.h"
#if defined(TRAFFIC_NET)
@@ -111,9 +112,6 @@ bool forceProcessRecordsSnap = false;
bool schema_on = false;
char *schema_path = NULL;
-bool xml_on = false;
-char *xml_path = NULL;
-
// TODO: Check if really need those
char system_root_dir[PATH_NAME_MAX + 1];
char system_runtime_dir[PATH_NAME_MAX + 1];
@@ -641,10 +639,6 @@ main(int argc, char **argv)
++i;
schema_path = argv[i];
schema_on = true;
- } else if (strcmp(argv[i], "-xml") == 0) { // hidden option
- ++i;
- xml_path = argv[i];
- xml_on = true;
} else {
printUsage();
}
@@ -682,15 +676,11 @@ main(int argc, char **argv)
extractConfigInfo(mgmt_path, recs_conf, userToRunAs, &fds_throttle);
set_process_limits(fds_throttle); // as root
-
runAsUser(userToRunAs);
-
setup_coredump();
-
check_lockfile();
- Layout::relative_to(config_internal_dir, sizeof(config_internal_dir),
- mgmt_path, "internal");
+ Layout::relative_to(config_internal_dir, sizeof(config_internal_dir), mgmt_path, "internal");
url_init(config_internal_dir);
mime_init(config_internal_dir);
http_init(config_internal_dir);
@@ -710,7 +700,7 @@ main(int argc, char **argv)
#if TS_HAS_WCCP
Init_Errata_Logging();
#endif
- lmgmt = new LocalManager(mgmt_path, new LMRecords(mgmt_path, recs_conf, 0), proxy_on);
+ lmgmt = new LocalManager(mgmt_path, proxy_on);
RecLocalInitMessage();
lmgmt->initAlarm();
@@ -827,7 +817,7 @@ main(int argc, char **argv)
}
if (proxy_backdoor != -1) {
- REC_setInteger("proxy.config.process_manager.mgmt_port", proxy_backdoor);
+ RecSetRecordInt("proxy.config.process_manager.mgmt_port", proxy_backdoor);
}
if (cluster_server_port == -1) {
@@ -908,74 +898,12 @@ main(int argc, char **argv)
statProcessor = NEW(new StatProcessor());
#endif
- if (xml_on) {
- converterInit();
- TrafficServer_xml(xml_path);
- }
-#if defined(OEM) && !defined(OEM_3COM)
-
- //For OEM releases we check here whether a floppy with the correct config file exists
- //if it does, we first configure the network, then we continue
- char floppyLockFile[256];
- snprintf(floppyLockFile, sizeof(floppyLockFile), "./etc/trafficserver/internal/floppy.dat");
- struct stat lockFileStat;
- FILE *floppy_lock_fd;
- bool floppyRestore = true;
-
- // Check for the presence of floppy.dat lock file in the etc/trafficserver/internal directory
- // If the lock is found, check if it is more than 120 seconds old.
- // If the lock file is missing or if it is more than 120 seconds old, create a new lock file
- // and restore network settings.
- if (stat(floppyLockFile, &lockFileStat) < 0) {
- perror("floppy.lock: ");
- if ((floppy_lock_fd = fopen(floppyLockFile, "w+")) == NULL) {
- mgmt_log(stderr, "[main] Could not create floppy.lock. Not restoring floppy configurations\n");
- floppyRestore = false;
- } else
- fclose(floppy_lock_fd);
- } else {
- time_t now;
- floppyRestore = false;
- if ((time(&now) - lockFileStat.st_mtime) > 120) {
- unlink(floppyLockFile);
- floppyRestore = true;
- if ((floppy_lock_fd = fopen(floppyLockFile, "w+")) == NULL) {
- mgmt_log(stderr, "[main] Could not create floppy.lock. Not restoring floppy configurations\n");
- floppyRestore = false;
- } else {
- fclose(floppy_lock_fd);
- }
- }
- }
-
- if (floppyRestore) {
- int oem_status;
- int old_euid = getuid();
- if (seteuid(0))
- perror("Main: Config_FloppyRestore setuid failed: ");
- if (setreuid(0, 0))
- perror("Main: Config_FloppyRestore setreuid failed: ");
- oem_status = Config_FloppyNetRestore();
- setreuid(old_euid, old_euid);
- if (oem_status) {
- Debug("lm", "[Main] Failed to initialize network using floppy configuration file\n");
- }
- //try a to queue a request for a restart
- //lmgmt->mgmt_shutdown_outstanding = true; //This is marked out as we don't need to restart
-
- }
-#endif //OEM - Floppy Configuration
-
for (;;) {
-
-
lmgmt->processEventQueue();
lmgmt->pollMgmtProcessServer();
// Check for a SIGHUP
if (sigHupNotifier != 0) {
- if (xml_on) // convert xml into TS config files
- TrafficServer_xml(xml_path);
mgmt_log(stderr, "[main] Reading Configuration Files due to SIGHUP\n");
configFiles->rereadConfig();
lmgmt->signalEvent(MGMT_EVENT_PLUGIN_CONFIG_UPDATE, "*");
@@ -987,12 +915,6 @@ main(int argc, char **argv)
xdump();
sigUsr2Notifier = 0;
}
-// if(lmgmt->processRunning() && just_started >= 10) { /* Sync the config/process records */
-// lmgmt->record_data->syncRecords();
-// } else {
-// /* Continue to update the db for config, this also syncs the records.config */
-// lmgmt->record_data->syncRecords(false);
-// }
lmgmt->ccom->generateClusterDelta();
@@ -1287,18 +1209,6 @@ fileUpdated(char *fname)
markMgmtIpAllowChange();
} else if (strcmp(fname, "ip_allow.config") == 0) {
lmgmt->signalFileChange("proxy.config.cache.ip_allow.filename");
-
- } else if (strcmp(fname, "lm.config") == 0) {
-
- /* Fix INKqa00919. The lm.config file is for stats only so
- * we should never need to re-read it and destroy stats
- * the manager has stored there
- *
- mgmt_log(stderr, "[fileUpdated] lm.config updated\n");
- if(lmgmt->record_data->rereadRecordFile(lmgmt->config_path, lm_conf) < 0) {
- mgmt_elog(stderr, "[FileUpdated] Config update failed for lm.config\n");
- }
- */
} else if (strcmp(fname, "vaddrs.config") == 0) {
mgmt_log(stderr, "[fileUpdated] vaddrs.config updated\n");
lmgmt->virt_map->lt_readAListFile(fname);
Modified: trafficserver/traffic/trunk/proxy/mgmt2/Makefile.am
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/Makefile.am?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/Makefile.am (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/Makefile.am Thu Dec 16 01:45:45 2010
@@ -49,21 +49,16 @@ bin_PROGRAMS = traffic_manager
libmgmt_p_a_SOURCES = \
BaseManager.cc \
BaseManager.h \
- BaseRecords.cc \
- BaseRecords.h \
MgmtDBM.cc \
MgmtDBM.h \
MgmtDefs.h \
ProcessManager.cc \
ProcessManager.h \
- ProcessRecords.cc \
- ProcessRecords.h \
RecordsConfig.cc \
RecordsConfig.h
librecords_a_CPPFLAGS = -DFOR_INSTALL $(AM_CPPFLAGS)
librecords_a_SOURCES = \
- BaseRecords.h \
MgmtDefs.h \
RecordsConfig.cc \
RecordsConfig.h
@@ -78,12 +73,8 @@ traffic_manager_SOURCES = \
AutoConf.h \
BaseManager.cc \
BaseManager.h \
- BaseRecords.cc \
- BaseRecords.h \
FileManager.cc \
FileManager.h \
- LMRecords.cc \
- LMRecords.h \
LocalManager.cc \
LocalManager.h \
Main.cc \
Modified: trafficserver/traffic/trunk/proxy/mgmt2/ProcessManager.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/ProcessManager.cc?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/ProcessManager.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/ProcessManager.cc Thu Dec 16 01:45:45 2010
@@ -81,8 +81,8 @@ startProcessManager(void *arg)
return ret;
} /* End startProcessManager */
-ProcessManager::ProcessManager(bool rlm, char *mpath, ProcessRecords * rd):
-BaseManager(), require_lm(rlm), mgmt_sync_key(0), record_data(rd), local_manager_sockfd(0)
+ProcessManager::ProcessManager(bool rlm, char *mpath):
+BaseManager(), require_lm(rlm), mgmt_sync_key(0), local_manager_sockfd(0)
{
NOWARN_UNUSED(mpath);
ink_strncpy(pserver_path, Layout::get()->runtimedir, sizeof(pserver_path));
@@ -92,16 +92,10 @@ BaseManager(), require_lm(rlm), mgmt_syn
// Making the process_manager thread a spinning thread to start traffic server
// as quickly as possible. Will reset this timeout when reconfigure()
timeout = 0;
-
+ pid = getpid();
} /* End ProcessManager::ProcessManager */
-// This function must be call after RecProcessInitMessage() has been invoked,
-// otherwise, REC_readInteger would result in randome values.
-#ifdef DEBUG_MGMT
-static void *drainBackDoor(void *arg);
-#endif
-
void
ProcessManager::reconfigure()
{
@@ -109,13 +103,6 @@ ProcessManager::reconfigure()
timeout = REC_readInteger("proxy.config.process_manager.timeout", &found);
ink_assert(found);
-#ifdef DEBUG_MGMT
- int enable_mgmt_port = REC_readInteger("proxy.config.process_manager.enable_mgmt_port", &found);
- ink_assert(found);
- if (enable_mgmt_port) {
- ink_thread_create(drainBackDoor, 0);
- }
-#endif /* DEBUG_MGMT */
return;
} /* End ProcessManager::reconfigure */
@@ -210,7 +197,6 @@ ProcessManager::initLMConnection()
MgmtMessageHdr mh_hdr;
MgmtMessageHdr *mh_full;
int data_len;
- pid_t pid;
char *sync_key_raw = NULL;
#ifndef _WIN32
@@ -240,8 +226,6 @@ ProcessManager::initLMConnection()
mgmt_fatal(stderr, "[ProcessManager::initLMConnection] Connect failed\n");
}
- /* Say HI! and give your name(pid). */
- pid = record_data->pid;
data_len = sizeof(pid_t);
mh_full = (MgmtMessageHdr *) alloca(sizeof(MgmtMessageHdr) + data_len);
mh_full->msg_id = MGMT_SIGNAL_PID;
@@ -276,8 +260,7 @@ ProcessManager::initLMConnection()
mgmt_fatal(stderr, "[ProcessManager::initLMConnection] Error opening named pipe: %s\n", ink_last_err());
}
- /* Say HI! and give your name(pid). */
- sprintf(message, "pid: %ld", record_data->pid);
+ sprintf(message, "pid: %ld", pid);
if (mgmt_write_pipe(local_manager_hpipe, message, strlen(message)) != 0) {
mgmt_fatal(stderr, "[ProcessManager::initLMConnection] Error writing message! %s\n", ink_last_err());
}
@@ -381,324 +364,48 @@ ProcessManager::handleMgmtMsgFromLM(Mgmt
{
char *data_raw = (char *) mh + sizeof(MgmtMessageHdr);
- if (!record_data->ignore_manager) { /* Check if we are speaking to the manager */
- switch (mh->msg_id) {
- case MGMT_EVENT_SHUTDOWN:
- signalMgmtEntity(MGMT_EVENT_SHUTDOWN);
- break;
- case MGMT_EVENT_RESTART:
- signalMgmtEntity(MGMT_EVENT_RESTART);
- break;
- case MGMT_EVENT_CLEAR_STATS:
- signalMgmtEntity(MGMT_EVENT_CLEAR_STATS);
- break;
- case MGMT_EVENT_ROLL_LOG_FILES:
- signalMgmtEntity(MGMT_EVENT_ROLL_LOG_FILES);
- break;
- case MGMT_EVENT_PLUGIN_CONFIG_UPDATE:
- if (data_raw != NULL && data_raw[0] != '\0') {
- global_config_cbs->invoke(data_raw);
- }
- break;
- case MGMT_EVENT_HTTP_CLUSTER_DELTA:
- signalMgmtEntity(MGMT_EVENT_HTTP_CLUSTER_DELTA, data_raw);
- break;
- case MGMT_EVENT_CONFIG_FILE_UPDATE:
- /*
- librecords -- we don't do anything in here because we are traffic_server
- and we are not the owner of proxy.config.* variables.
- Even if we trigger the sync_required bit, by
- RecSetSynRequired, the sync. message will send back to
- traffic_manager. And traffic_manager founds out that, the
- actual value of the config variable didn't changed.
- At the end, the sync_required bit is not set and we will
- never get notified and callbacks are never invoked.
-
- The solution is to set the sync_required bit on the
- manager side. See LocalManager::sendMgmtMsgToProcesses()
- for details.
- */
- break;
- case MGMT_EVENT_LIBRECORDS:
- signalMgmtEntity(MGMT_EVENT_LIBRECORDS, data_raw, mh->data_len);
- break;
- default:
- mgmt_elog(stderr, "[ProcessManager::pollLMConnection] unknown type %d\n", mh->msg_id);
- break;
- }
- }
-}
-
-bool
-ProcessManager::addPluginCounter(const char *name, MgmtIntCounter value)
-{
- if (record_data->addPluginCounter(name, value) == true) {
- char msg[512];
- sprintf(msg, "%s %d %" PRId64 "", name, INK_COUNTER, value);
- signalManager(MGMT_SIGNAL_PLUGIN_ADD_REC, msg);
- return true;
+ switch (mh->msg_id) {
+ case MGMT_EVENT_SHUTDOWN:
+ signalMgmtEntity(MGMT_EVENT_SHUTDOWN);
+ break;
+ case MGMT_EVENT_RESTART:
+ signalMgmtEntity(MGMT_EVENT_RESTART);
+ break;
+ case MGMT_EVENT_CLEAR_STATS:
+ signalMgmtEntity(MGMT_EVENT_CLEAR_STATS);
+ break;
+ case MGMT_EVENT_ROLL_LOG_FILES:
+ signalMgmtEntity(MGMT_EVENT_ROLL_LOG_FILES);
+ break;
+ case MGMT_EVENT_PLUGIN_CONFIG_UPDATE:
+ if (data_raw != NULL && data_raw[0] != '\0') {
+ global_config_cbs->invoke(data_raw);
+ }
+ break;
+ case MGMT_EVENT_HTTP_CLUSTER_DELTA:
+ signalMgmtEntity(MGMT_EVENT_HTTP_CLUSTER_DELTA, data_raw);
+ break;
+ case MGMT_EVENT_CONFIG_FILE_UPDATE:
+ /*
+ librecords -- we don't do anything in here because we are traffic_server
+ and we are not the owner of proxy.config.* variables.
+ Even if we trigger the sync_required bit, by
+ RecSetSynRequired, the sync. message will send back to
+ traffic_manager. And traffic_manager founds out that, the
+ actual value of the config variable didn't changed.
+ At the end, the sync_required bit is not set and we will
+ never get notified and callbacks are never invoked.
+
+ The solution is to set the sync_required bit on the
+ manager side. See LocalManager::sendMgmtMsgToProcesses()
+ for details.
+ */
+ break;
+ case MGMT_EVENT_LIBRECORDS:
+ signalMgmtEntity(MGMT_EVENT_LIBRECORDS, data_raw, mh->data_len);
+ break;
+ default:
+ mgmt_elog(stderr, "[ProcessManager::pollLMConnection] unknown type %d\n", mh->msg_id);
+ break;
}
-
- return false;
}
-
-bool
-ProcessManager::addPluginInteger(const char *name, MgmtInt value)
-{
- if (record_data->addPluginInteger(name, value) == true) {
- char msg[512];
- sprintf(msg, "%s %d %" PRId64 "", name, INK_INT, value);
- pmgmt->signalManager(MGMT_SIGNAL_PLUGIN_ADD_REC, msg);
- return true;
- }
-
- return false;
-}
-
-bool
-ProcessManager::addPluginFloat(const char *name, MgmtFloat value)
-{
- if (record_data->addPluginFloat(name, value) == true) {
- char msg[512];
- sprintf(msg, "%s %d %.5f", name, INK_FLOAT, value);
- pmgmt->signalManager(MGMT_SIGNAL_PLUGIN_ADD_REC, msg);
- return true;
- }
-
- return false;
-}
-
-bool
-ProcessManager::addPluginString(const char *name, MgmtString value)
-{
- if (record_data->addPluginString(name, value) == true) {
- char msg[512];
- sprintf(msg, "%s %d %s", name, INK_STRING, value);
- pmgmt->signalManager(MGMT_SIGNAL_PLUGIN_ADD_REC, msg);
- return true;
- }
-
- return false;
-}
-
-#ifdef DEBUG_MGMT
-static bool checkBackDoorP(int req_fd, char *message);
-/*
- * drainBackDoor(...)
- * This function is blocking, it never returns. It is meant to allow for
- * continuous draining of the network.
- */
-static void *
-drainBackDoor(void *arg)
-{
- bool found;
- int port, fd, one = 1;
- //
- // Don't allocate the message buffer on the stack..
- //
- const int message_size = 61440;
- char *message = new char[message_size];
- fd_set fdlist;
- struct sockaddr_in cli_addr, serv_addr;
- void *ret = arg;
-
- while (!pmgmt) {
- mgmt_sleep_sec(1);
- }
-
- port = (int)
- REC_readInteger("proxy.config.process_manager.mgmt_port", &found);
- if (!found) {
- mgmt_log(stderr, "[drainBackDoor] Unable to get mgmt port config variable\n");
- }
-
- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- mgmt_log(stderr, "[drainBackDoor] Unable to create socket\n");
- return ret;
- }
-
- if (fcntl(fd, F_SETFD, 1) < 0) {
- mgmt_fatal(stderr, "[drainBackDoor] Unable to set close-on-exec\n");
- }
-
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &one, sizeof(int)) < 0) {
- mgmt_log(stderr, "[drainBackDoor] Unable to setsockopt\n");
- return ret;
- }
-
- memset(&serv_addr, 0, sizeof(serv_addr));
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
- serv_addr.sin_port = htons(port);
-
- if ((bind(fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr))) < 0) {
- mgmt_log(stderr, "[drainBackDoor] Unable to bind socket\n");
- return ret;
- }
-
- if ((listen(fd, 10)) < 0) {
- mgmt_log(stderr, "[drainBackDoor] Unable to listen on socket\n");
- return ret;
- }
-
- for (;;) { /* Loop draining mgmt network */
-
- memset(message, 0, message_size);
- FD_ZERO(&fdlist);
- FD_SET(fd, &fdlist);
- mgmt_select(FD_SETSIZE, &fdlist, NULL, NULL, NULL);
-
- if (FD_ISSET(fd, &fdlist)) { /* Request */
- int clilen = sizeof(cli_addr);
- int req_fd = accept(fd, (struct sockaddr *) &cli_addr, &clilen);
-
- if (fcntl(req_fd, F_SETFD, 1) < 0) {
- mgmt_elog(stderr, "[drainBackDoor] Unable to set close on exec flag\n");
- close_socket(req_fd);
- continue;
- }
-
- if (req_fd < 0) {
- mgmt_elog(stderr, "[drainBackDoor] Request accept failed\n");
- continue;
- } else {
-
- if (mgmt_readline(req_fd, message, 61440) > 0 && !checkBackDoorP(req_fd, message)) { /* Heh... */
- mgmt_elog(stderr, "[drainBackDoor] Received unknown message: '%s'\n", message);
- close_socket(req_fd);
- continue;
- }
- }
- close_socket(req_fd);
- }
- }
- return ret;
-} /* End drainBackDoor */
-
-
-/*
- * checkBackDoorP(...)
- * Function checks for "backdoor" inktomi commands on dedicated back door port.
- */
-static bool
-checkBackDoorP(int req_fd, char *message)
-{
- char reply[4096];
-
- if (strstr(message, "read ")) {
- int id;
- char variable[1024];
- RecordType type;
- InkHashTableValue hash_value;
-
- if (sscanf(message, "read %s\n", variable) != 1) {
- mgmt_elog(stderr, "[CBDP] Bad message(%d) '%s'\n", __LINE__, message);
- return false;
- }
-
- if (pmgmt->record_data->idofRecord(variable, &id, &type)) {
-
- ink_mutex_acquire(&(pmgmt->record_data->mutex[type]));
- if (pmgmt->record_data->record_type_map->mgmt_hash_table_lookup((InkHashTableKey) type, &hash_value) != 0) {
- Records *the_records = (Records *) hash_value;
- switch (the_records->recs[id].stype) {
- case INK_COUNTER:
- sprintf(reply, "\nRecord '%s' Val: '%" PRId64 "'\n", the_records->recs[id].name,
- the_records->recs[id].data.counter_data);
- break;
- case INK_INT:
- sprintf(reply, "\nRecord: '%s' Val: '%" PRId64 "'\n", the_records->recs[id].name,
- the_records->recs[id].data.int_data);
- break;
- case INK_FLOAT:
- sprintf(reply, "\nRecord: '%s' Val: '%f'\n", the_records->recs[id].name,
- the_records->recs[id].data.float_data);
- break;
- case INK_STRING:
- if (the_records->recs[id].name) {
- sprintf(reply, "\nRecord: '%s' Val: '%s'\n", the_records->recs[id].name,
- the_records->recs[id].data.string_data);
- } else {
- sprintf(reply, "\nRecord: '%s' Val: NULL\n", the_records->recs[id].name);
- }
- break;
- default:
- break;
- }
- mgmt_writeline(req_fd, reply, strlen(reply));
- }
- ink_mutex_release(&(pmgmt->record_data->mutex[type]));
- } else {
- mgmt_elog(stderr, "[checkBackDoorP] Unknown variable requested '%s'\n", variable);
- }
- return true;
- } else if (strstr(message, "write ")) {
- int id;
- char variable[1024], value[1024];
- RecordType type;
-
- if (sscanf(message, "write %s %s", variable, value) != 2) {
- mgmt_elog(stderr, "[CBDP] Bad message(%d) '%s'\n", __LINE__, message);
- return false;
- }
- if (pmgmt->record_data->idofRecord(variable, &id, &type)) {
- switch (pmgmt->record_data->typeofRecord(id, type)) {
- case INK_COUNTER:
- pmgmt->record_data->setCounter(id, type, ink_atoi64(value));
- break;
- case INK_INT:
- pmgmt->record_data->setInteger(id, type, ink_atoi64(value));
- break;
- case INK_FLOAT:
- pmgmt->record_data->setFloat(id, type, atof(value));
- break;
- case INK_STRING:
- pmgmt->record_data->setString(id, type, value);
- break;
- default:
- break;
- }
- strcpy(reply, "\nRecord Updated\n\n");
- mgmt_writeline(req_fd, reply, strlen(reply));
-
- } else {
- mgmt_elog(stderr, "[checkBackDoorP] Assignment to unknown variable requested '%s'\n", variable);
- }
- return true;
- } else if (strstr(message, "signal ")) {
- int id;
- char value[1024];
- RecordType type;
-
- if (sscanf(message, "signal %s", value) != 1) {
- mgmt_elog(stderr, "[CBDP] Bad message(%d) '%s'\n", __LINE__, message);
- return false;
- }
- if (pmgmt->record_data->idofRecord(value, &id, &type) && type == CONFIG) {
- ink_mutex_acquire(&(pmgmt->record_data->mutex[CONFIG]));
- pmgmt->record_data->config_data.recs[id].changed = true;
- ink_mutex_release(&(pmgmt->record_data->mutex[CONFIG]));
- } else {
- mgmt_elog(stderr, "[checkBackDoorP] Unknown signal change: '%s'\n", value);
- }
- return true;
- } else if (strstr(message, "toggle_ignore")) {
-
- if (pmgmt->record_data->ignore_manager) {
- mgmt_log(stderr, "[checkBackDoorP] Now ignoring lm\n");
- pmgmt->record_data->ignore_manager = true;
- } else {
- mgmt_log(stderr, "[checkBackDoorP] Now listening to lm\n");
- pmgmt->record_data->ignore_manager = false;
- }
- return true;
- } else if (strstr(message, "shutdown")) {
- char *reply = "[checkBackDoorP] Shutting down\n";
- pmgmt->signalMgmtEntity(MGMT_EVENT_SHUTDOWN);
- mgmt_writeline(req_fd, reply, strlen(reply));
- return true;
- }
- return false;
-} /* End checkBackDoorP */
-
-#endif /* DEBUG_MGMT */
Modified: trafficserver/traffic/trunk/proxy/mgmt2/ProcessManager.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/ProcessManager.h?rev=1049764&r1=1049763&r2=1049764&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/ProcessManager.h (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/ProcessManager.h Thu Dec 16 01:45:45 2010
@@ -36,7 +36,7 @@
#ifndef _PROCESS_MANAGER_H
#define _PROCESS_MANAGER_H
-#include "ProcessRecords.h"
+#include "MgmtUtils.h"
#include "BaseManager.h"
#include "ink_sock.h"
@@ -47,11 +47,9 @@ class ProcessManager:public BaseManager
{
public:
-
- ProcessManager(bool rlm, char *mpath, ProcessRecords * rd);
+ ProcessManager(bool rlm, char *mpath);
~ProcessManager()
{
- delete record_data;
#ifndef _WIN32
close_socket(local_manager_sockfd);
#else
@@ -91,26 +89,15 @@ public:
bool processEventQueue();
bool processSignalQueue();
- /*
- * addPlugin*(...)
- * Functions for adding plugin defined variables.
- *
- * Returns: true if sucessful
- * false otherwise
- */
- bool addPluginCounter(const char *name, MgmtIntCounter value);
- bool addPluginInteger(const char *name, MgmtInt value);
- bool addPluginFloat(const char *name, MgmtFloat value);
- bool addPluginString(const char *name, MgmtString value);
-
bool require_lm;
time_t timeout;
char pserver_path[1024];
int mgmt_sync_key;
- ProcessRecords *record_data;
LLQ *mgmt_signal_queue;
+ pid_t pid;
+
#ifndef _WIN32
int local_manager_sockfd;
#else