From b5a98df6343da6229b1b102883d8e992cd4a55a5 Mon Sep 17 00:00:00 2001 From: Joseph Fernandes Date: Mon, 13 Jul 2015 18:45:11 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/11648 Tested-by: Joseph Fernandes Tested-by: NetBSD Build System Reviewed-by: Dan Lambright --- libglusterfs/src/gfdb/gfdb_sqlite3.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libglusterfs') 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); -- cgit