From: Sage Weil Date: Sun, 1 Mar 2009 05:58:34 +0000 (-0800) Subject: config: rename logger/dout config fields to make more sense X-Git-Tag: v0.7~89 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bb32760fd330778fcec65dfd5cbc167d8e79dd64;p=ceph.git config: rename logger/dout config fields to make more sense 'logger' is the common/Logger.cc stats/instrumentation. 'log' is the dout() log business. --- diff --git a/src/common/Logger.cc b/src/common/Logger.cc index 488573d7887..fcc7e7212f4 100644 --- a/src/common/Logger.cc +++ b/src/common/Logger.cc @@ -81,18 +81,18 @@ static void flush_all_loggers() int now_sec = fromstart.sec(); // do any catching up we need to - while (now_sec - last_flush >= g_conf.log_interval) { + while (now_sec - last_flush >= g_conf.logger_interval) { generic_dout(20) << "fromstart " << fromstart << " last_flush " << last_flush << " flushing" << dendl; for (list::iterator p = logger_list.begin(); p != logger_list.end(); ++p) (*p)->_flush(); - last_flush += g_conf.log_interval; + last_flush += g_conf.logger_interval; } // schedule next flush event utime_t next; - next.sec_ref() = start.sec() + last_flush + g_conf.log_interval; + next.sec_ref() = start.sec() + last_flush + g_conf.logger_interval; next.usec_ref() = start.usec(); generic_dout(20) << "logger now=" << now << " start=" << start @@ -111,7 +111,7 @@ void Logger::_open_log() Mutex::Locker l(logger_lock); struct stat st; - if (!g_conf.log) + if (!g_conf.logger) return; filename = ""; @@ -129,8 +129,8 @@ void Logger::_open_log() ::mkdir(filename.c_str(), 0750); filename += "/"; - if (g_conf.log_name) { - filename += g_conf.log_name; + if (g_conf.logger_subdir) { + filename += g_conf.logger_subdir; ::mkdir( filename.c_str(), 0755 ); // make sure dir exists filename += "/"; } @@ -225,7 +225,7 @@ void Logger::_flush() long Logger::inc(int key, long v) { - if (!open || !g_conf.log) + if (!open || !g_conf.logger) return 0; logger_lock.Lock(); int i = type->lookup_key(key); @@ -237,7 +237,7 @@ long Logger::inc(int key, long v) double Logger::finc(int key, double v) { - if (!open || !g_conf.log) + if (!open || !g_conf.logger) return 0; logger_lock.Lock(); int i = type->lookup_key(key); @@ -249,7 +249,7 @@ double Logger::finc(int key, double v) long Logger::set(int key, long v) { - if (!open || !g_conf.log) + if (!open || !g_conf.logger) return 0; logger_lock.Lock(); int i = type->lookup_key(key); @@ -262,7 +262,7 @@ long Logger::set(int key, long v) double Logger::fset(int key, double v) { - if (!open || !g_conf.log) + if (!open || !g_conf.logger) return 0; logger_lock.Lock(); int i = type->lookup_key(key); @@ -274,7 +274,7 @@ double Logger::fset(int key, double v) double Logger::favg(int key, double v) { - if (!open || !g_conf.log) + if (!open || !g_conf.logger) return 0; logger_lock.Lock(); int i = type->lookup_key(key); @@ -288,7 +288,7 @@ double Logger::favg(int key, double v) long Logger::get(int key) { - if (!open || !g_conf.log) + if (!open || !g_conf.logger) return 0; logger_lock.Lock(); int i = type->lookup_key(key); diff --git a/src/common/debug.cc b/src/common/debug.cc index 1a73f83369b..b76b34c7f6a 100644 --- a/src/common/debug.cc +++ b/src/common/debug.cc @@ -23,27 +23,27 @@ bool _dout_need_open = true; void _dout_open_log() { // logging enabled? - if (!(g_conf.dout_dir && g_conf.file_logs)) { + if (!(g_conf.log_dir && g_conf.file_logs)) { _dout_need_open = false; return; } // calculate log dir, filename, etc. if (!_dout_path[0]) { - if (g_conf.dout_dir[0] == '/') - strcpy(_dout_dir, g_conf.dout_dir); + if (g_conf.log_dir[0] == '/') + strcpy(_dout_dir, g_conf.log_dir); else { getcwd(_dout_dir, 100); strcat(_dout_dir, "/"); - strcat(_dout_dir, g_conf.dout_dir); + strcat(_dout_dir, g_conf.log_dir); } - if (g_conf.dout_sym_dir[0] == '/') - strcpy(_dout_symlink_dir, g_conf.dout_sym_dir); + if (g_conf.log_sym_dir[0] == '/') + strcpy(_dout_symlink_dir, g_conf.log_sym_dir); else { getcwd(_dout_symlink_dir, 100); strcat(_dout_symlink_dir, "/"); - strcat(_dout_symlink_dir, g_conf.dout_sym_dir); + strcat(_dout_symlink_dir, g_conf.log_sym_dir); } char hostname[80]; @@ -69,7 +69,7 @@ void _dout_open_log() int _dout_rename_output_file() // after calling daemon() { - if (g_conf.dout_dir && g_conf.file_logs) { + if (g_conf.log_dir && g_conf.file_logs) { char oldpath[1000]; char hostname[80]; gethostname(hostname, 79); @@ -90,7 +90,7 @@ int _dout_rename_output_file() // after calling daemon() int _dout_create_courtesy_output_symlink(const char *type, int n) { - if (g_conf.dout_dir && g_conf.file_logs) { + if (g_conf.log_dir && g_conf.file_logs) { if (_dout_need_open) _dout_open_log(); diff --git a/src/config.cc b/src/config.cc index b6e214a57ae..d82eed844f4 100644 --- a/src/config.cc +++ b/src/config.cc @@ -200,18 +200,15 @@ md_config_t g_conf = { file_logs: false, // profiling and debugging - log: true, - log_interval: 1, - log_name: (char*)0, - - log_messages: true, - log_pins: true, - + logger: true, + logger_interval: 1, logger_calc_variance: true, - - dout_dir: INSTALL_PREFIX "/var/log/ceph", // if daemonize == true - dout_sym_dir: INSTALL_PREFIX "/var/log/ceph", // if daemonize == true + logger_subdir: 0, logger_dir: INSTALL_PREFIX "/var/log/ceph/stat", + + log_dir: INSTALL_PREFIX "/var/log/ceph", // if daemonize == true + log_sym_dir: INSTALL_PREFIX "/var/log/ceph", // if daemonize == true + pid_file: 0, conf_file: INSTALL_PREFIX "/etc/ceph/ceph.conf", @@ -630,18 +627,20 @@ void parse_config_file(ConfFile *cf, bool auto_update) CF_READ("global", "num mds", num_mds); CF_READ("global", "num osd", num_osd); CF_READ("global", "mkfs", mkfs); + CF_READ_STR("global", "monmap file", monmap_file); CF_READ("global", "daemonize", daemonize); CF_READ("global", "file logs", file_logs); - CF_READ("global", "log", log); - CF_READ("global", "log interval", log_interval); - CF_READ_STR("global", "log name", log_name); - CF_READ("global", "log messages", log_messages); - CF_READ("global", "log pins", log_pins); - CF_READ_STR("global", "dout dir", dout_dir); - CF_READ_STR("global", "dout sym dir", dout_sym_dir); + CF_READ("global", "logger", logger); + CF_READ("global", "logger interval", logger_interval); + CF_READ_STR("global", "logger calc variance", logger_subdir); + CF_READ_STR("global", "logger subdir", logger_subdir); CF_READ_STR("global", "logger dir", logger_dir); + + CF_READ_STR("global", "log dir", log_dir); + CF_READ_STR("global", "log sym dir", log_sym_dir); + CF_READ_STR("global", "pid file", pid_file); - CF_READ_STR("global", "monmap file", monmap_file); + CF_READ("global", "chdir root", chdir_root); CF_READ("debug", "debug", debug); @@ -950,11 +949,11 @@ void parse_config_options(std::vector& args, bool open) //g_conf.fake_osd_sync = atoi(args[++i]); - else if (strcmp(args[i], "--dout_dir") == 0 && isarg) - g_conf.dout_dir = args[++i]; + else if (strcmp(args[i], "--log_dir") == 0 && isarg) + g_conf.log_dir = args[++i]; else if (//strcmp(args[i], "-o") == 0 || - strcmp(args[i], "--dout_sym_dir") == 0 && isarg) - g_conf.dout_sym_dir = args[++i]; + strcmp(args[i], "--log_sym_dir") == 0 && isarg) + g_conf.log_sym_dir = args[++i]; else if (strcmp(args[i], "--logger_dir") == 0 && isarg) g_conf.logger_dir = args[++i]; else if ((strcmp(args[i], "--pid_file") == 0 || @@ -1085,10 +1084,10 @@ void parse_config_options(std::vector& args, bool open) g_debug_after_conf = g_conf; } - else if (strcmp(args[i], "--log") == 0 && isarg) - g_conf.log = atoi(args[++i]); - else if (strcmp(args[i], "--log_name") == 0 && isarg) - g_conf.log_name = args[++i]; + else if (strcmp(args[i], "--logger") == 0 && isarg) + g_conf.logger = atoi(args[++i]); + else if (strcmp(args[i], "--logger_subdir") == 0 && isarg) + g_conf.logger_subdir = args[++i]; else if (strcmp(args[i], "--fakemessenger_serialize") == 0 && isarg) g_conf.fakemessenger_serialize = atoi(args[++i]); diff --git a/src/config.h b/src/config.h index da8df5cdd15..13955204849 100644 --- a/src/config.h +++ b/src/config.h @@ -40,10 +40,10 @@ extern const char *get_pool_name(int pool); extern entity_addr_t g_my_addr; struct md_config_t { - int num_mon; - int num_mds; - int num_osd; - int num_client; + int num_mon; + int num_mds; + int num_osd; + int num_client; bool mkfs; @@ -52,19 +52,16 @@ struct md_config_t { bool daemonize; bool file_logs; - // profiling - bool log; - int log_interval; - const char *log_name; - - bool log_messages; - bool log_pins; - + // logger (profiling) + bool logger; + int logger_interval; bool logger_calc_variance; - - const char *dout_dir; - const char *dout_sym_dir; + const char *logger_subdir; const char *logger_dir; + + const char *log_dir; + const char *log_sym_dir; + const char *pid_file; const char *conf_file; diff --git a/src/dstart.sh b/src/dstart.sh index 71aabcdce15..f74a72f05f6 100755 --- a/src/dstart.sh +++ b/src/dstart.sh @@ -33,7 +33,7 @@ while [ $# -ge 1 ]; do done -ARGS="--dout_dir /data/`hostname`" +ARGS="--log_dir /data/`hostname`" MOUNTOPTIONS="-o notreelog,flushoncommit" @@ -144,7 +144,7 @@ do ssh root@$host cd $HOME/ceph/src \; ./cosd --mkfs_for_osd $osd $devm # --osd_auto_weight 1 fi echo starting cosd - ssh root@$host cd $HOME/ceph/src \; ulimit -c unlimited \; ./crun $norestart ./cosd $devm --dout_dir /data/$host $COSD_ARGS -f & + ssh root@$host cd $HOME/ceph/src \; ulimit -c unlimited \; ./crun $norestart ./cosd $devm --log_dir /data/$host $COSD_ARGS -f & done done diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 44b4b9bc3f4..8ac83388fd2 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -6092,7 +6092,7 @@ void MDCache::request_cleanup(MDRequest *mdr) //mds->logger->set("buf",buffer_total_alloc); } - if (g_conf.log_pins) { + //if (g_conf.log_pins) { // pin /* for (int i=0; isecond); } */ - } + //} }