summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorJoseph Fernandes <josferna@redhat.com>2015-11-30 16:51:35 +0530
committerDan Lambright <dlambrig@redhat.com>2015-12-04 16:46:51 -0800
commitd5df0db18b29b1db2577ac5ed388966c0eb203b0 (patch)
treec5b2a74a070db952bd4773386eee4c75379c0f08 /libglusterfs
parent0ef60a5c371359d2a5d0d8684a8a58f1f5801525 (diff)
tier/libgfdb/sql: Correcting logic in sql query for read
Correcting query in the where clause from "a & b | c" to "a & (b | c)" where "a" is the condition to join the gf_file_tb and gf_flink_tb through gfids "b" is the condition for the write heat and "c" is the condition for read heat Backport of http://review.gluster.org/12823 > Change-Id: I99226d82b0efb68fbef3a40f02b215bb2b4370d6 > BUG: 1286656 > Signed-off-by: Joseph Fernandes <josferna@redhat.com> > Signed-off-by: Dan Lambright <dlambrig@redhat.com> > Reviewed-on: http://review.gluster.org/12823 > Tested-by: NetBSD Build System <jenkins@build.gluster.org> > Tested-by: Gluster Build System <jenkins@build.gluster.com> Signed-off-by: Joseph Fernandes <josferna@redhat.com> Change-Id: I70533c8589a6cd67e8737e110af0a23abed9013d BUG: 1287583 Reviewed-on: http://review.gluster.org/12868 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/gfdb/gfdb_sqlite3.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3.c b/libglusterfs/src/gfdb/gfdb_sqlite3.c
index c4ce86d9ef0..4d46ff64c6e 100644
--- a/libglusterfs/src/gfdb/gfdb_sqlite3.c
+++ b/libglusterfs/src/gfdb/gfdb_sqlite3.c
@@ -708,12 +708,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,
@@ -804,12 +804,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,
@@ -909,14 +909,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,
@@ -1054,7 +1054,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"
@@ -1071,7 +1071,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,