From 097795df7ebab48515d75e95a2c29e5ab42ac5ee Mon Sep 17 00:00:00 2001 From: Joseph Fernandes Date: Wed, 1 Apr 2015 02:56:23 +0530 Subject: ctr : Fix for heating of files during promotion/demotion This fix will solve the heating of the files during the promotion or demotion. Promotion: ~~~~~~~~~ When a file gets promoted it get the current time stamp during creation only, but following writes or reads during the migration wont heat the file. Demotion: ~~~~~~~~ When a file gets demoted it get the wind/unwind time stamp is set to zero. The following writes or reads during the migration wont heat the file. What is remaining ? ~~~~~~~~~~~~~~~~~ Bug 1209129 ( https://bugzilla.redhat.com/show_bug.cgi?id=1209129 ) Inspite of this fix there is still a issue remaining, i.e the heat of the file is not keep intact during a internal rebalance activity i.e a rebalance within a tier. Change-Id: I01e82dc226355599732d40e699062cee7960b0a5 BUG: 1207867 Signed-off-by: Joseph Fernandes Signed-off-by: Dan Lambright Signed-off-by: Joseph Fernandes Reviewed-on: http://review.gluster.org/10080 Reviewed-by: Shyamsundar Ranganathan Tested-by: Gluster Build System --- libglusterfs/src/common-utils.h | 1 + libglusterfs/src/gfdb/gfdb_data_store_types.h | 4 +++ libglusterfs/src/gfdb/gfdb_sqlite3.c | 2 +- libglusterfs/src/gfdb/gfdb_sqlite3_helper.c | 43 ++++++++++++++++----------- 4 files changed, 31 insertions(+), 19 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 7cc85e8fe48..ec7e772e6cb 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -120,6 +120,7 @@ enum _gf_client_pid GF_CLIENT_PID_GLFS_HEAL = -7, GF_CLIENT_PID_BITD = -8, GF_CLIENT_PID_SCRUB = -9, + GF_CLIENT_PID_TIER_DEFRAG = -10 }; enum _gf_xlator_ipc_targets { diff --git a/libglusterfs/src/gfdb/gfdb_data_store_types.h b/libglusterfs/src/gfdb/gfdb_data_store_types.h index 4dd1584b6cd..94708ac1d3b 100644 --- a/libglusterfs/src/gfdb/gfdb_data_store_types.h +++ b/libglusterfs/src/gfdb/gfdb_data_store_types.h @@ -292,7 +292,11 @@ typedef struct gfdb_db_record { /* but for dentry fops we update the LINK_UPDATE, so an extra */ /* flag is provided to ignore the recording of the unwind time. */ gf_boolean_t do_record_uwind_time; + /* Global flag to record or not record counters */ gf_boolean_t do_record_counters; + /* Global flag to Record/Not Record wind or wind time. + * This flag will overrule do_record_uwind_time*/ + gf_boolean_t do_record_times; } gfdb_db_record_t; diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3.c b/libglusterfs/src/gfdb/gfdb_sqlite3.c index 1bfeb811f6b..b9de3d3a3a6 100644 --- a/libglusterfs/src/gfdb/gfdb_sqlite3.c +++ b/libglusterfs/src/gfdb/gfdb_sqlite3.c @@ -852,7 +852,7 @@ gf_sqlite3_find_recently_changed_files_freq (void *db_conn, " OR " /*Second condition: For Reads */ "( ((" GF_COL_TB_RWSEC " * " TOSTRING(GFDB_MICROSEC) " + " - GF_COL_TB_RWMSEC ") <= ?)" + GF_COL_TB_RWMSEC ") >= ?)" " AND "" (" GF_COL_TB_RFC " >= ? ) )"; from_time_usec = gfdb_time_2_usec(from_time); diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c b/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c index 14aec204917..4d925e95ef7 100644 --- a/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c +++ b/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c @@ -807,15 +807,18 @@ gf_sql_insert_wind (gf_sql_connection_t *sql_conn, } } - /*All fops update times read or write*/ - ret = gf_update_time (sql_conn, gfid_str, modtime, - gfdb_db_record->do_record_counters, - its_wind, - isreadfop (gfdb_db_record->gfdb_fop_type)); - if (ret) { - gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR, - "Failed update wind time in DB"); - goto out; + /* update times only when said!*/ + if (gfdb_db_record->do_record_times) { + /*All fops update times read or write*/ + ret = gf_update_time (sql_conn, gfid_str, modtime, + gfdb_db_record->do_record_counters, + its_wind, + isreadfop (gfdb_db_record->gfdb_fop_type)); + if (ret) { + gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR, + "Failed update wind time in DB"); + goto out; + } } ret = 0; @@ -851,7 +854,8 @@ gf_sql_insert_unwind (gf_sql_connection_t *sql_conn, } /*Only update if recording unwind is set*/ - if (gfdb_db_record->do_record_uwind_time) { + if (gfdb_db_record->do_record_times && + gfdb_db_record->do_record_uwind_time) { modtime = &gfdb_db_record->gfdb_unwind_change_time; ret = gf_update_time (sql_conn, gfid_str, modtime, gfdb_db_record->do_record_counters, @@ -918,16 +922,18 @@ gf_sql_update_delete_wind (gf_sql_connection_t *sql_conn, goto out; } - /*Update the wind write times*/ - modtime = &gfdb_db_record->gfdb_unwind_change_time; - ret = gf_update_time (sql_conn, gfid_str, modtime, + if (gfdb_db_record->do_record_times) { + /*Update the wind write times*/ + modtime = &gfdb_db_record->gfdb_wind_change_time; + ret = gf_update_time (sql_conn, gfid_str, modtime, gfdb_db_record->do_record_counters, _gf_true, isreadfop (gfdb_db_record->gfdb_fop_type)); - if (ret) { - gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR, - "Failed update wind time in DB"); - goto out; + if (ret) { + gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR, + "Failed update wind time in DB"); + goto out; + } } ret = gf_sql_update_link_flags (sql_conn, gfid_str, pargfid_str, @@ -989,7 +995,8 @@ gf_sql_delete_unwind (gf_sql_connection_t *sql_conn, goto out; } - if (gfdb_db_record->do_record_uwind_time) { + if (gfdb_db_record->do_record_times && + gfdb_db_record->do_record_uwind_time) { ret = gf_update_time (sql_conn, gfid_str, modtime, gfdb_db_record->do_record_counters, _gf_false, -- cgit