From f34a1a12427043c9409df0861a3b95e6350e1107 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Tue, 10 Jan 2017 15:39:55 -0500 Subject: [PATCH 312/361] geo-rep: Separate slave mount logs for each connection Geo-rep worker mounts the slave volume on the slave node. If multiple worker connects to same slave node, all workers share the same mount log file. This is very difficult to debug as logs are cluttered from different mounts. Hence creating separate mount log file for each connection from worker. Each connection from worker is identified uniquely using 'mastervol uuid', 'master host', 'master brickpath', 'salve vol'. The log file name will be combination of the above. mainline: > BUG: 1412689 > Reviewed-on: http://review.gluster.org/16384 > Smoke: Gluster Build System > NetBSD-regression: NetBSD Build System > CentOS-regression: Gluster Build System > Reviewed-by: Aravinda VK (cherry picked from commit 67d1410d2cc8539a026ce6e62f9783c836b2f407) BUG: 1414750 Change-Id: I67871dc8e8ea5864e2ad55e2a82063be0138bf0c Signed-off-by: Kotresh HR Reviewed-on: https://code.engineering.redhat.com/gerrit/101292 Tested-by: Milind Changire Reviewed-by: Atin Mukherjee --- geo-replication/syncdaemon/configinterface.py | 12 ++++++++++++ geo-replication/syncdaemon/gsyncd.py | 4 +++- geo-replication/syncdaemon/resource.py | 6 ++++++ xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 6 +++--- xlators/mgmt/glusterd/src/glusterd.c | 6 +++--- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/geo-replication/syncdaemon/configinterface.py b/geo-replication/syncdaemon/configinterface.py index b5935df..50e7aed 100644 --- a/geo-replication/syncdaemon/configinterface.py +++ b/geo-replication/syncdaemon/configinterface.py @@ -78,6 +78,18 @@ CONFIGS = ( "${slavevol}/${eSlave}.status", GLUSTERD_WORKDIR + "/geo-replication/${mastervol}_${remotehost}_" "${slavevol}/monitor.status"), + ("peersrx .", + "log_file", + "${iprefix}/log/glusterfs/geo-replication-slaves/${session_owner}:${eSlave}.log", + "${iprefix}/log/glusterfs/geo-replication-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.log"), + ("peersrx .", + "log_file_mbr", + "${iprefix}/log/glusterfs/geo-replication-slaves/mbr/${session_owner}:${eSlave}.log", + "${iprefix}/log/glusterfs/geo-replication-slaves/mbr/${session_owner}:${local_node}${local_id}.${slavevol}.log"), + ("peersrx .", + "gluster_log_file", + "${iprefix}/log/glusterfs/geo-replication-slaves/${session_owner}:${eSlave}.gluster.log", + "${iprefix}/log/glusterfs/geo-replication-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.gluster.log") ) diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py index 76d9939..eccc5ea 100644 --- a/geo-replication/syncdaemon/gsyncd.py +++ b/geo-replication/syncdaemon/gsyncd.py @@ -413,7 +413,8 @@ def main_i(): if (o.callback in (store_abs, 'store_true', None) and o.get_opt_string() not in ('--version', '--help'))] remote_tunables = ['listen', 'go_daemon', 'timeout', - 'session_owner', 'config_file', 'use_rsync_xattrs'] + 'session_owner', 'config_file', 'use_rsync_xattrs', + 'local_id', 'local_node'] rq_remote_tunables = {'listen': True} # precedence for sources of values: 1) commandline, 2) cfg file, 3) @@ -541,6 +542,7 @@ def main_i(): namedict[name + 'vol'] = x.volume if name == 'remote': namedict['remotehost'] = x.remotehost + if not 'config_file' in rconf: rconf['config_file'] = TMPL_CONFIG_FILE diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index be97b16..9ac5c2d 100644 --- a/geo-replication/syncdaemon/resource.py +++ b/geo-replication/syncdaemon/resource.py @@ -970,6 +970,12 @@ class SlaveRemote(object): so = getattr(gconf, 'session_owner', None) if so: extra_opts += ['--session-owner', so] + li = getattr(gconf, 'local_id', None) + if li: + extra_opts += ['--local-id', li] + ln = getattr(gconf, 'local_node', None) + if ln: + extra_opts += ['--local-node', ln] if boolify(gconf.use_rsync_xattrs): extra_opts.append('--use-rsync-xattrs') po = Popen(rargs + gconf.remote_gsyncd.split() + extra_opts + diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index 9a702b7..872f3ff 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -6123,7 +6123,7 @@ create_conf_file (glusterd_conf_t *conf, char *conf_path) runinit_gsyncd_setrx (&runner, conf_path); runner_add_args (&runner, "log-file", - DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${eSlave}.log", + DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.log", ".", NULL); RUN_GSYNCD_CMD; @@ -6131,7 +6131,7 @@ create_conf_file (glusterd_conf_t *conf, char *conf_path) runinit_gsyncd_setrx (&runner, conf_path); runner_add_args (&runner, "log-file-mbr", - DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr/${session_owner}:${eSlave}.log", + DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr/${session_owner}:${local_node}${local_id}.${slavevol}.log", ".", NULL); RUN_GSYNCD_CMD; @@ -6139,7 +6139,7 @@ create_conf_file (glusterd_conf_t *conf, char *conf_path) runinit_gsyncd_setrx (&runner, conf_path); runner_add_args (&runner, "gluster-log-file", - DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${eSlave}.gluster.log", + DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.gluster.log", ".", NULL); RUN_GSYNCD_CMD; diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index 3bcf2d5..6599c53 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -804,7 +804,7 @@ configure_syncdaemon (glusterd_conf_t *conf) runinit_gsyncd_setrx (&runner, conf); runner_add_args (&runner, "log-file", - DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${eSlave}.log", + DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.log", ".", NULL); RUN_GSYNCD_CMD; @@ -812,7 +812,7 @@ configure_syncdaemon (glusterd_conf_t *conf) runinit_gsyncd_setrx (&runner, conf); runner_add_args (&runner, "log-file-mbr", - DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr/${session_owner}:${eSlave}.log", + DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr/${session_owner}:${local_node}${local_id}.${slavevol}.log", ".", NULL); RUN_GSYNCD_CMD; @@ -820,7 +820,7 @@ configure_syncdaemon (glusterd_conf_t *conf) runinit_gsyncd_setrx (&runner, conf); runner_add_args (&runner, "gluster-log-file", - DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${eSlave}.gluster.log", + DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.gluster.log", ".", NULL); RUN_GSYNCD_CMD; -- 1.8.3.1