summaryrefslogtreecommitdiffstats
path: root/xlators/features/changelog/lib/src/gf-history-changelog.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features/changelog/lib/src/gf-history-changelog.c')
-rw-r--r--xlators/features/changelog/lib/src/gf-history-changelog.c119
1 files changed, 71 insertions, 48 deletions
diff --git a/xlators/features/changelog/lib/src/gf-history-changelog.c b/xlators/features/changelog/lib/src/gf-history-changelog.c
index 736237219f4..0bf130a0883 100644
--- a/xlators/features/changelog/lib/src/gf-history-changelog.c
+++ b/xlators/features/changelog/lib/src/gf-history-changelog.c
@@ -77,10 +77,12 @@ gf_history_changelog_done (char *file)
"moving %s to processed directory", file);
ret = sys_rename (buffer, to_path);
if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, errno,
- CHANGELOG_LIB_MSG_RENAME_FAILED,
- "cannot move %s to %s",
- file, to_path);
+ gf_smsg (this->name, GF_LOG_ERROR, errno,
+ CHANGELOG_LIB_MSG_RENAME_FAILED,
+ "cannot move changelog file",
+ "from=%s", file,
+ "to=%s", to_path,
+ NULL);
goto out;
}
@@ -529,10 +531,11 @@ gf_changelog_consume_wrap (void* data)
ret = gf_changelog_consume (ccd->this,
ccd->jnl, ccd->changelog, _gf_true);
if (ret) {
- gf_msg (this->name, GF_LOG_ERROR,
- 0, CHANGELOG_LIB_MSG_PARSE_ERROR,
- "could not parse changelog: %s",
- ccd->changelog);
+ gf_smsg (this->name, GF_LOG_ERROR,
+ 0, CHANGELOG_LIB_MSG_PARSE_ERROR,
+ "could not parse changelog",
+ "name=%s", ccd->changelog,
+ NULL);
goto out;
}
}
@@ -726,10 +729,11 @@ gf_changelog_extract_min_max (const char *dname, const char *htime_dir,
ret = sys_stat (htime_file, &stbuf);
if (ret) {
ret = -1;
- gf_msg (this->name, GF_LOG_ERROR, errno,
- CHANGELOG_LIB_MSG_HTIME_ERROR,
- "stat() failed on htime file %s",
- htime_file);
+ gf_smsg (this->name, GF_LOG_ERROR, errno,
+ CHANGELOG_LIB_MSG_HTIME_ERROR,
+ "stat() failed on htime file",
+ "path=%s", htime_file,
+ NULL);
goto out;
}
@@ -742,10 +746,11 @@ gf_changelog_extract_min_max (const char *dname, const char *htime_dir,
*fd = open (htime_file, O_RDONLY);
if (*fd < 0) {
ret = -1;
- gf_msg (this->name, GF_LOG_ERROR, errno,
- CHANGELOG_LIB_MSG_HTIME_ERROR,
- "open() failed for htime %s",
- htime_file);
+ gf_smsg (this->name, GF_LOG_ERROR, errno,
+ CHANGELOG_LIB_MSG_HTIME_ERROR,
+ "open() failed for htime file",
+ "path=%s", htime_file,
+ NULL);
goto out;
}
@@ -753,18 +758,22 @@ gf_changelog_extract_min_max (const char *dname, const char *htime_dir,
ret = sys_fgetxattr (*fd, HTIME_KEY, x_value, sizeof (x_value));
if (ret < 0) {
ret = -1;
- gf_msg (this->name, GF_LOG_ERROR, errno,
- CHANGELOG_LIB_MSG_GET_XATTR_FAILED,
- "error extracting max timstamp from htime file"
- " %s", htime_file);
+ gf_smsg (this->name, GF_LOG_ERROR, errno,
+ CHANGELOG_LIB_MSG_GET_XATTR_FAILED,
+ "error extracting max timstamp from htime file"
+ "path=%s", htime_file,
+ NULL);
goto out;
}
sscanf (x_value, "%lu:%lu", max_ts, total);
- gf_msg (this->name, GF_LOG_INFO, 0,
- CHANGELOG_LIB_MSG_TOTAL_LOG_INFO,
- "MIN: %lu, MAX: %lu, TOTAL CHANGELOGS: %lu",
- *min_ts, *max_ts, *total);
+ gf_smsg (this->name, GF_LOG_INFO, 0,
+ CHANGELOG_LIB_MSG_TOTAL_LOG_INFO,
+ "changelogs min max",
+ "min=%lu", *min_ts,
+ "max=%lu", *max_ts,
+ "total_changelogs=%lu", *total,
+ NULL);
ret = 0;
@@ -830,10 +839,12 @@ gf_history_changelog (char* changelog_dir, unsigned long start,
/* basic sanity check */
if (start > end || n_parallel <= 0) {
- gf_msg (this->name, GF_LOG_ERROR, errno,
- CHANGELOG_LIB_MSG_HIST_FAILED, "Sanity check failed. "
- "START - %lu END - %lu THREAD_COUNT - %d",
- start, end, n_parallel);
+ gf_smsg (this->name, GF_LOG_ERROR, errno,
+ CHANGELOG_LIB_MSG_HIST_FAILED, "Sanity check failed",
+ "start=%lu", start,
+ "end=%lu", end,
+ "thread_count=%d", n_parallel,
+ NULL);
ret = -1;
goto out;
}
@@ -846,10 +857,11 @@ gf_history_changelog (char* changelog_dir, unsigned long start,
dirp = sys_opendir (htime_dir);
if (dirp == NULL) {
- gf_msg (this->name, GF_LOG_ERROR, errno,
- CHANGELOG_LIB_MSG_HTIME_ERROR,
- "open dir on htime failed : %s",
- htime_dir);
+ gf_smsg (this->name, GF_LOG_ERROR, errno,
+ CHANGELOG_LIB_MSG_HTIME_ERROR,
+ "open dir on htime failed",
+ "path=%s", htime_dir,
+ NULL);
ret = -1;
goto out;
}
@@ -897,10 +909,12 @@ gf_history_changelog (char* changelog_dir, unsigned long start,
/* ensuring correctness of gf_b_search */
if (gf_history_check (fd, from, start, len) != 0) {
ret = -1;
- gf_msg (this->name, GF_LOG_ERROR, 0,
- CHANGELOG_LIB_MSG_GET_TIME_ERROR,
- "wrong result for start: %lu idx: %lu",
- start, from);
+ gf_smsg (this->name, GF_LOG_ERROR, 0,
+ CHANGELOG_LIB_MSG_GET_TIME_ERROR,
+ "wrong result for start",
+ "start=%lu", start,
+ "idx=%lu", from,
+ NULL);
goto out;
}
@@ -914,10 +928,12 @@ gf_history_changelog (char* changelog_dir, unsigned long start,
if (gf_history_check (fd, to, end2, len) != 0) {
ret = -1;
- gf_msg (this->name, GF_LOG_ERROR, 0,
- CHANGELOG_LIB_MSG_GET_TIME_ERROR,
- "wrong result for start: %lu idx: %lu",
- end2, to);
+ gf_smsg (this->name, GF_LOG_ERROR, 0,
+ CHANGELOG_LIB_MSG_GET_TIME_ERROR,
+ "wrong result for start",
+ "start=%lu", end2,
+ "idx=%lu", to,
+ NULL);
goto out;
}
@@ -929,10 +945,13 @@ gf_history_changelog (char* changelog_dir, unsigned long start,
if (ret == -1)
goto out;
- gf_msg (this->name, GF_LOG_INFO, 0,
- CHANGELOG_LIB_MSG_TOTAL_LOG_INFO,
- "FINAL: from: %lu, to: %lu, changes: %lu",
- ts1, ts2, (to - from + 1));
+ gf_smsg (this->name, GF_LOG_INFO, 0,
+ CHANGELOG_LIB_MSG_TOTAL_LOG_INFO,
+ "FINAL",
+ "from=%lu", ts1,
+ "to=%lu", ts2,
+ "changes=%lu", (to - from + 1),
+ NULL);
hist_data = GF_CALLOC (1,
sizeof (gf_changelog_history_data_t),
@@ -972,10 +991,14 @@ gf_history_changelog (char* changelog_dir, unsigned long start,
goto out;
} else {/* end of range check */
- gf_msg (this->name, GF_LOG_ERROR, errno,
- CHANGELOG_LIB_MSG_HIST_FAILED, "Requested changelog "
- "range is not available. START - %lu CHLOG_MIN - %lu "
- "CHLOG_MAX - %lu", start, min_ts, max_ts);
+ gf_smsg (this->name, GF_LOG_ERROR, errno,
+ CHANGELOG_LIB_MSG_HIST_FAILED,
+ "Requested changelog "
+ "range is not available.",
+ "start=%lu", start,
+ "chlog_min=%lu", min_ts,
+ "chlog_max=%lu", max_ts,
+ NULL);
ret = -2;
goto out;
}