geo-rep: Convert gfid mismatch logs to structured logging

Convert the logs related to entry failures fix
due to gfid mismatch logs into structured logging
format

Change-Id: I9bce950c5339b48d3ec8b84bddee38b0473b7634
Updates: #246
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: https://review.gluster.org/17896
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
This commit is contained in:
Kotresh HR 2017-07-27 07:32:36 -04:00 committed by Aravinda VK
parent 1ae254ddcf
commit de69fb7ac8

View File

@ -796,8 +796,9 @@ class GMasterChangelogMixin(GMasterCommon):
slave_gfid = failure[2]['slave_gfid']
st = lstat(os.path.join(pfx, slave_gfid))
if isinstance(st, int) and st == ENOENT:
logging.info ("Fixing gfid mismatch [%s]: Deleting %s"
% (retry_count, repr(failure)))
logging.info(lf('Fixing gfid mismatch in slave. Deleting'
' the entry', retry_count=retry_count,
entry=repr(failure)))
#Add deletion to fix_entry_ops list
pbname = failure[0]['entry']
if failure[2]['slave_isdir']:
@ -812,8 +813,9 @@ class GMasterChangelogMixin(GMasterCommon):
#The file exists on master but with different name.
#Probabaly renamed and got missed during xsync crawl.
if failure[2]['slave_isdir']:
logging.info ("Fixing gfid mismatch [%s]: %s"
% (retry_count, repr(failure)))
logging.info(lf('Fixing gfid mismatch in slave',
retry_count=retry_count,
entry=repr(failure)))
realpath = os.readlink(os.path.join(gconf.local_path,
".glusterfs",
slave_gfid[0:2],
@ -825,18 +827,23 @@ class GMasterChangelogMixin(GMasterCommon):
entry=failure[0]['entry'],
entry1=dst_entry, stat=st,
link=None)
logging.info ("Fixing gfid mismatch [%s]: Renaming %s"
% (retry_count, repr(rename_dict)))
logging.info(lf('Fixing gfid mismatch in slave. '
'Renaming', retry_count=retry_count,
entry=repr(rename_dict)))
fix_entry_ops.append(rename_dict)
else:
logging.info ("Fixing gfid mismatch [%s]: Deleting %s"
% (retry_count, repr(failure)))
logging.info(lf('Fixing gfid mismatch in slave. '
' Deleting the entry',
retry_count=retry_count,
entry=repr(failure)))
pbname = failure[0]['entry']
fix_entry_ops.append(edct('UNLINK',
gfid=failure[2]['slave_gfid'],
entry=pbname))
logging.error ("GFID MISMATCH: ENTRY CANNOT BE FIXED: "
"gfid: %s" % slave_gfid)
logging.error(lf('Entry cannot be fixed in slave due '
'to GFID mismatch, find respective '
'path for the GFID and trigger sync',
gfid=slave_gfid))
if fix_entry_ops:
#Process deletions of entries whose gfids are mismatched