|
|
3604df |
From f3febe9d625f6b524e62aac502916e3b06ef04b1 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Poornima G <pgurusid@redhat.com>
|
|
|
3604df |
Date: Tue, 2 Aug 2016 14:51:23 +0530
|
|
|
3604df |
Subject: [PATCH 119/141] md-cache: Add logging to increase debuggability
|
|
|
3604df |
|
|
|
3604df |
Change-Id: I147d16ec3c20d3372892fdd5f62010e52f82f8bd
|
|
|
3604df |
BUG: 1284873
|
|
|
3604df |
Signed-off-by: Poornima G <pgurusid@redhat.com>
|
|
|
3604df |
Reviewed-on: http://review.gluster.org/15069
|
|
|
3604df |
Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
|
|
|
3604df |
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/87032
|
|
|
3604df |
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
3604df |
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
.../performance/md-cache/src/md-cache-messages.h | 4 +-
|
|
|
3604df |
xlators/performance/md-cache/src/md-cache.c | 56 +++++++++++++++++---
|
|
|
3604df |
2 files changed, 51 insertions(+), 9 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/xlators/performance/md-cache/src/md-cache-messages.h b/xlators/performance/md-cache/src/md-cache-messages.h
|
|
|
3604df |
index a4259ba..1fe26cc 100644
|
|
|
3604df |
--- a/xlators/performance/md-cache/src/md-cache-messages.h
|
|
|
3604df |
+++ b/xlators/performance/md-cache/src/md-cache-messages.h
|
|
|
3604df |
@@ -40,7 +40,7 @@
|
|
|
3604df |
*/
|
|
|
3604df |
|
|
|
3604df |
#define GLFS_MD_CACHE_BASE GLFS_MSGID_COMP_MD_CACHE
|
|
|
3604df |
-#define GLFS_MD_CACHE_NUM_MESSAGES 2
|
|
|
3604df |
+#define GLFS_MD_CACHE_NUM_MESSAGES 3
|
|
|
3604df |
#define GLFS_MSGID_END (GLFS_MD_CACHE_BASE + GLFS_MD_CACHE_NUM_MESSAGES + 1)
|
|
|
3604df |
|
|
|
3604df |
/* Messages with message IDs */
|
|
|
3604df |
@@ -67,6 +67,8 @@
|
|
|
3604df |
|
|
|
3604df |
#define MD_CACHE_MSG_DISCARD_UPDATE (GLFS_MD_CACHE_BASE + 2)
|
|
|
3604df |
|
|
|
3604df |
+#define MD_CACHE_MSG_CACHE_UPDATE (GLFS_MD_CACHE_BASE + 3)
|
|
|
3604df |
+
|
|
|
3604df |
/*------------*/
|
|
|
3604df |
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
|
|
|
3604df |
|
|
|
3604df |
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
|
|
|
3604df |
index d15da04..28e7a57 100644
|
|
|
3604df |
--- a/xlators/performance/md-cache/src/md-cache.c
|
|
|
3604df |
+++ b/xlators/performance/md-cache/src/md-cache.c
|
|
|
3604df |
@@ -463,6 +463,8 @@ mdc_inode_iatt_set_validate(xlator_t *this, inode_t *inode, struct iatt *prebuf,
|
|
|
3604df |
LOCK (&mdc->lock);
|
|
|
3604df |
{
|
|
|
3604df |
if (!iatt || !iatt->ia_ctime) {
|
|
|
3604df |
+ gf_msg_trace ("md-cache", 0, "invalidating iatt(NULL)"
|
|
|
3604df |
+ "(%s)", uuid_utoa (inode->gfid));
|
|
|
3604df |
mdc->ia_time = 0;
|
|
|
3604df |
goto unlock;
|
|
|
3604df |
}
|
|
|
3604df |
@@ -508,12 +510,22 @@ mdc_inode_iatt_set_validate(xlator_t *this, inode_t *inode, struct iatt *prebuf,
|
|
|
3604df |
if (!prebuf || (prebuf->ia_ctime != mdc->md_ctime) ||
|
|
|
3604df |
(prebuf->ia_ctime_nsec != mdc->md_ctime_nsec) ||
|
|
|
3604df |
(prebuf->ia_mtime != mdc->md_mtime) ||
|
|
|
3604df |
- (prebuf->ia_mtime_nsec != mdc->md_mtime_nsec))
|
|
|
3604df |
+ (prebuf->ia_mtime_nsec != mdc->md_mtime_nsec)) {
|
|
|
3604df |
+ gf_msg_trace ("md-cache", 0, "prebuf doesn't "
|
|
|
3604df |
+ "match the value we have cached,"
|
|
|
3604df |
+ " invalidate the inode(%s)",
|
|
|
3604df |
+ uuid_utoa (inode->gfid));
|
|
|
3604df |
+
|
|
|
3604df |
inode_invalidate(inode);
|
|
|
3604df |
+ }
|
|
|
3604df |
|
|
|
3604df |
mdc_from_iatt (mdc, iatt);
|
|
|
3604df |
|
|
|
3604df |
time (&mdc->ia_time);
|
|
|
3604df |
+ gf_msg_callingfn ("md-cache", GF_LOG_TRACE, 0,
|
|
|
3604df |
+ MD_CACHE_MSG_CACHE_UPDATE, "Updated iatt(%s)"
|
|
|
3604df |
+ " time:%lld ", uuid_utoa (inode->gfid),
|
|
|
3604df |
+ (long long)mdc->ia_time);
|
|
|
3604df |
}
|
|
|
3604df |
unlock:
|
|
|
3604df |
UNLOCK (&mdc->lock);
|
|
|
3604df |
@@ -533,11 +545,17 @@ mdc_inode_iatt_get (xlator_t *this, inode_t *inode, struct iatt *iatt)
|
|
|
3604df |
int ret = -1;
|
|
|
3604df |
struct md_cache *mdc = NULL;
|
|
|
3604df |
|
|
|
3604df |
- if (mdc_inode_ctx_get (this, inode, &mdc) != 0)
|
|
|
3604df |
+ if (mdc_inode_ctx_get (this, inode, &mdc) != 0) {
|
|
|
3604df |
+ gf_msg_trace ("md-cache", 0, "mdc_inode_ctx_get failed (%s)",
|
|
|
3604df |
+ uuid_utoa (inode->gfid));
|
|
|
3604df |
goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
|
|
|
3604df |
- if (!is_md_cache_iatt_valid (this, mdc))
|
|
|
3604df |
+ if (!is_md_cache_iatt_valid (this, mdc)) {
|
|
|
3604df |
+ gf_msg_trace ("md-cache", 0, "iatt cache not valid for (%s)",
|
|
|
3604df |
+ uuid_utoa (inode->gfid));
|
|
|
3604df |
goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
|
|
|
3604df |
LOCK (&mdc->lock);
|
|
|
3604df |
{
|
|
|
3604df |
@@ -644,12 +662,17 @@ mdc_inode_xatt_set (xlator_t *this, inode_t *inode, dict_t *dict)
|
|
|
3604df |
if (!mdc)
|
|
|
3604df |
goto out;
|
|
|
3604df |
|
|
|
3604df |
- if (!dict)
|
|
|
3604df |
+ if (!dict) {
|
|
|
3604df |
+ gf_msg_trace ("md-cache", 0, "mdc_inode_xatt_set failed (%s) "
|
|
|
3604df |
+ "dict NULL", uuid_utoa (inode->gfid));
|
|
|
3604df |
goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
|
|
|
3604df |
LOCK (&mdc->lock);
|
|
|
3604df |
{
|
|
|
3604df |
if (mdc->xattr) {
|
|
|
3604df |
+ gf_msg_trace ("md-cache", 0, "deleteing the old xattr "
|
|
|
3604df |
+ "cache (%s)", uuid_utoa (inode->gfid));
|
|
|
3604df |
dict_unref (mdc->xattr);
|
|
|
3604df |
mdc->xattr = NULL;
|
|
|
3604df |
}
|
|
|
3604df |
@@ -664,6 +687,9 @@ mdc_inode_xatt_set (xlator_t *this, inode_t *inode, dict_t *dict)
|
|
|
3604df |
mdc->xattr = newdict;
|
|
|
3604df |
|
|
|
3604df |
time (&mdc->xa_time);
|
|
|
3604df |
+ gf_msg_trace ("md-cache", 0, "xatt cache set for (%s) time:%lld",
|
|
|
3604df |
+ uuid_utoa (inode->gfid), (long long)mdc->xa_time);
|
|
|
3604df |
+
|
|
|
3604df |
}
|
|
|
3604df |
UNLOCK (&mdc->lock);
|
|
|
3604df |
ret = 0;
|
|
|
3604df |
@@ -734,11 +760,17 @@ mdc_inode_xatt_get (xlator_t *this, inode_t *inode, dict_t **dict)
|
|
|
3604df |
int ret = -1;
|
|
|
3604df |
struct md_cache *mdc = NULL;
|
|
|
3604df |
|
|
|
3604df |
- if (mdc_inode_ctx_get (this, inode, &mdc) != 0)
|
|
|
3604df |
+ if (mdc_inode_ctx_get (this, inode, &mdc) != 0) {
|
|
|
3604df |
+ gf_msg_trace ("md-cache", 0, "mdc_inode_ctx_get failed (%s)",
|
|
|
3604df |
+ uuid_utoa (inode->gfid));
|
|
|
3604df |
goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
|
|
|
3604df |
- if (!is_md_cache_xatt_valid (this, mdc))
|
|
|
3604df |
+ if (!is_md_cache_xatt_valid (this, mdc)) {
|
|
|
3604df |
+ gf_msg_trace ("md-cache", 0, "xattr cache not valid for (%s)",
|
|
|
3604df |
+ uuid_utoa (inode->gfid));
|
|
|
3604df |
goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
|
|
|
3604df |
LOCK (&mdc->lock);
|
|
|
3604df |
{
|
|
|
3604df |
@@ -746,8 +778,11 @@ mdc_inode_xatt_get (xlator_t *this, inode_t *inode, dict_t **dict)
|
|
|
3604df |
/* Missing xattr only means no keys were there, i.e
|
|
|
3604df |
a negative cache for the "loaded" keys
|
|
|
3604df |
*/
|
|
|
3604df |
- if (!mdc->xattr)
|
|
|
3604df |
+ if (!mdc->xattr) {
|
|
|
3604df |
+ gf_msg_trace ("md-cache", 0, "xattr not present (%s)",
|
|
|
3604df |
+ uuid_utoa (inode->gfid));
|
|
|
3604df |
goto unlock;
|
|
|
3604df |
+ }
|
|
|
3604df |
|
|
|
3604df |
if (dict)
|
|
|
3604df |
*dict = dict_ref (mdc->xattr);
|
|
|
3604df |
@@ -883,6 +918,8 @@ is_mdc_key_satisfied (const char *key)
|
|
|
3604df |
return 1;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
+ gf_msg_trace ("md-cache", 0, "xattr key %s doesn't satisfy "
|
|
|
3604df |
+ "caching requirements", key);
|
|
|
3604df |
return 0;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
@@ -961,12 +998,15 @@ mdc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
|
|
|
3604df |
|
|
|
3604df |
loc_copy (&local->loc, loc);
|
|
|
3604df |
|
|
|
3604df |
- if (!loc->name)
|
|
|
3604df |
+ if (!loc->name) {
|
|
|
3604df |
+ gf_msg_trace ("md-cache", 0, "Nameless lookup(%s) sent to the "
|
|
|
3604df |
+ "brick", uuid_utoa (loc->inode->gfid));
|
|
|
3604df |
/* A nameless discovery is dangerous to serve from cache. We
|
|
|
3604df |
perform nameless lookup with the intention of
|
|
|
3604df |
re-establishing an inode "properly"
|
|
|
3604df |
*/
|
|
|
3604df |
goto uncached;
|
|
|
3604df |
+ }
|
|
|
3604df |
|
|
|
3604df |
ret = mdc_inode_iatt_get (this, loc->inode, &stbuf);
|
|
|
3604df |
if (ret != 0)
|
|
|
3604df |
--
|
|
|
3604df |
1.7.1
|
|
|
3604df |
|