summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Fernandes <josferna@redhat.com>2015-07-13 18:45:11 +0530
committerDan Lambright <dlambrig@redhat.com>2015-08-12 06:47:43 -0700
commitb5a98df6343da6229b1b102883d8e992cd4a55a5 (patch)
treeb06d3300386803208d4426cc901ac5bcf0ba52f4
parente8ea08d9a9ca9e507919c121b3a2e56fd5f580f4 (diff)
tier/libgfdb : Setting Freq counters of un-selected files to zero
Change Time Recorder increments the write/read frequency counters on a read or write of a file, if the "features.record-counters" is "on". It is the responsibility of the tiering migrator to reset these counters to zero for un-selected files to reset them to zero as frequency counters are function of promotion/Demotion cycles. If the counters are not set to zero then, 1) the counters may overflow in the DB 2) The file may be wrongly promoted or demoted. This fix will reset the freq counters of un-selected files to zero after promotion/demotion frequency. Change-Id: Ideea2c76a52d421a7e67c37fb0c823f552b3da7a BUG: 1242504 Signed-off-by: Joseph Fernandes <josferna@redhat.com> Reviewed-on: http://review.gluster.org/11648 Tested-by: Joseph Fernandes Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
-rw-r--r--libglusterfs/src/gfdb/gfdb_sqlite3.c18
-rw-r--r--xlators/cluster/dht/src/tier.c4
2 files changed, 20 insertions, 2 deletions
diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3.c b/libglusterfs/src/gfdb/gfdb_sqlite3.c
index 349ff60f541..5f4a0fc94ae 100644
--- a/libglusterfs/src/gfdb/gfdb_sqlite3.c
+++ b/libglusterfs/src/gfdb/gfdb_sqlite3.c
@@ -726,6 +726,15 @@ gf_sqlite3_find_recently_changed_files(void *db_conn,
goto out;
}
+ /*Clear freq counters of un-selected data*/
+ ret = gf_sql_clear_counters(sql_conn);
+ if (ret) {
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CLEAR_COUNTER_FAILED, "Failed clearing"
+ " counters!");
+ goto out;
+ }
+
ret = 0;
out:
sqlite3_finalize(prep_stmt);
@@ -811,6 +820,15 @@ gf_sqlite3_find_unchanged_for_time (void *db_conn,
goto out;
}
+ /*Clear freq counters of un-selected data*/
+ ret = gf_sql_clear_counters(sql_conn);
+ if (ret) {
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CLEAR_COUNTER_FAILED, "Failed clearing"
+ " counters!");
+ goto out;
+ }
+
ret = 0;
out:
sqlite3_finalize(prep_stmt);
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index 66a08d10801..26c96a89039 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -508,7 +508,7 @@ tier_process_brick_cbk (dict_t *brick_dict, char *key, data_t *value,
write_freq_threshold,
query_cbk_args->defrag->
read_freq_threshold,
- _gf_false);
+ _gf_true);
}
} else {
if (query_cbk_args->defrag->write_freq_threshold == 0 &&
@@ -527,7 +527,7 @@ tier_process_brick_cbk (dict_t *brick_dict, char *key, data_t *value,
query_cbk_args->defrag->
write_freq_threshold,
query_cbk_args->defrag->read_freq_threshold,
- _gf_false);
+ _gf_true);
}
}
if (ret) {