diff options
-rw-r--r-- | libglusterfs/src/gfdb/gfdb_sqlite3.c | 16 | ||||
-rw-r--r-- | tests/basic/tier/frequency-counters.t | 15 |
2 files changed, 17 insertions, 14 deletions
diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3.c b/libglusterfs/src/gfdb/gfdb_sqlite3.c index e45a21d66c8..d43911830ed 100644 --- a/libglusterfs/src/gfdb/gfdb_sqlite3.c +++ b/libglusterfs/src/gfdb/gfdb_sqlite3.c @@ -709,12 +709,12 @@ gf_sqlite3_find_recently_changed_files(void *db_conn, ret = gf_asprintf (&query_str, "%s AND" /*First condition: For writes*/ - "((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + " + "( ((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + " GF_COL_TB_WMSEC ") >= ? )" " OR " /*Second condition: For reads*/ "((" GF_COL_TB_RWSEC " * " TOSTRING(GFDB_MICROSEC) " + " - GF_COL_TB_RWMSEC ") >= ?)", base_query_str); + GF_COL_TB_RWMSEC ") >= ?) )", base_query_str); if (ret < 0) { gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_QUERY_FAILED, @@ -805,12 +805,12 @@ gf_sqlite3_find_unchanged_for_time (void *db_conn, ret = gf_asprintf (&query_str, "%s AND " /*First condition: For writes*/ - "((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + " + "( ((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + " GF_COL_TB_WMSEC ") <= ? )" " AND " /*Second condition: For reads*/ "((" GF_COL_TB_RWSEC " * " TOSTRING(GFDB_MICROSEC) " + " - GF_COL_TB_RWMSEC ") <= ?)", base_query_str); + GF_COL_TB_RWMSEC ") <= ?) )", base_query_str); if (ret < 0) { gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_QUERY_FAILED, @@ -910,14 +910,14 @@ gf_sqlite3_find_recently_changed_files_freq (void *db_conn, } ret = gf_asprintf (&query_str, "%s AND " /*First condition: For Writes*/ - "( ((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + " + "( ( ((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + " GF_COL_TB_WMSEC ") >= ? )" " AND "" (" GF_COL_TB_WFC " >= ? ) )" " OR " /*Second condition: For Reads */ "( ((" GF_COL_TB_RWSEC " * " TOSTRING(GFDB_MICROSEC) " + " GF_COL_TB_RWMSEC ") >= ?)" - " AND "" (" GF_COL_TB_RFC " >= ? ) )", base_query_str); + " AND "" (" GF_COL_TB_RFC " >= ? ) ) )", base_query_str); if (ret < 0) { gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_QUERY_FAILED, @@ -1055,7 +1055,7 @@ gf_sqlite3_find_unchanged_for_time_freq (void *db_conn, * OR * File that have write wind time greater than for_time, * but write_frequency less than freq_write_cnt*/ - "( ((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + " + "( ( ((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + " GF_COL_TB_WMSEC ") < ? )" " OR " "( (" GF_COL_TB_WFC " < ? ) AND" @@ -1072,7 +1072,7 @@ gf_sqlite3_find_unchanged_for_time_freq (void *db_conn, " OR " "( (" GF_COL_TB_RFC " < ? ) AND" "((" GF_COL_TB_RWSEC " * " TOSTRING(GFDB_MICROSEC) " + " - GF_COL_TB_RWMSEC ") >= ? ) ) )", base_query_str); + GF_COL_TB_RWMSEC ") >= ? ) ) ) )", base_query_str); if (ret < 0) { gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_QUERY_FAILED, diff --git a/tests/basic/tier/frequency-counters.t b/tests/basic/tier/frequency-counters.t index 707b8b4bbc6..51c7ab4a700 100644 --- a/tests/basic/tier/frequency-counters.t +++ b/tests/basic/tier/frequency-counters.t @@ -40,7 +40,6 @@ TEST glusterd #Create and start a tiered volume create_dist_vol $NUM_BRICKS -$CLI volume set $V0 diagnostics.client-log-level DEBUG # Mount FUSE TEST glusterfs -s $H0 --volfile-id $V0 $M0 @@ -48,7 +47,8 @@ TEST glusterfs -s $H0 --volfile-id $V0 $M0 mkdir $M0/$TEST_DIR cd $M0/${TEST_DIR} -touch file{1..2} +date > file1 +touch file2 # attach tier create_dist_tier_vol $NUM_BRICKS @@ -56,19 +56,22 @@ create_dist_tier_vol $NUM_BRICKS sleep_until_mid_cycle $PROMOTE_FREQ # check if promotion on single hit, should fail -echo "hi" >> file2 +date >> file2 +cat file1 drop_cache $M0 sleep $PROMOTE_FREQ EXPECT "0" check_counters 0 0 # check if promotion on double hit, should suceed sleep_until_mid_cycle $PROMOTE_FREQ -echo "hi" >> file2 +date >> file2 drop_cache $M0 -echo "hi" >> file2 +cat file1 +date >> file2 drop_cache $M0 +cat file1 -EXPECT_WITHIN $PROMOTE_FREQ "0" check_counters 1 0 +EXPECT_WITHIN $PROMOTE_FREQ "0" check_counters 2 0 TEST ! $CLI volume set $V0 features.record-counters off |