Blob Blame History Raw
From 7bf79190a0e43e91ce96d0b0726afd590967f9cd Mon Sep 17 00:00:00 2001
From: Joseph Fernandes <josferna@redhat.com>
Date: Wed, 8 Jul 2015 14:35:45 +0530
Subject: [PATCH 227/234] libgfdb/sql: Fixing broken query of find_unchanged

The find_unchanged query should be

          "write_heat <= defined_heat" AND "read_heat <= defined_heat"
   and not
          "write_heat <= defined_heat" OR "read_heat <= defined_heat"

>> Backport of http://review.gluster.org/#/c/11577/
>> Change-Id: Ie82e02aafbb7ea14563007307de3350ea022049a
>> BUG: 1240970
Signed-off-by: Joseph Fernandes <josferna@redhat.com>

Change-Id: I6d7a148925f13cc2048c3713e944f45e8b1a6853
BUG: 1240925
Reviewed-on: https://code.engineering.redhat.com/gerrit/52745
Reviewed-by: Kaleb Keithley <kkeithle@redhat.com>
Tested-by: Kaleb Keithley <kkeithle@redhat.com>
---
 libglusterfs/src/gfdb/gfdb_sqlite3.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3.c b/libglusterfs/src/gfdb/gfdb_sqlite3.c
index 94553fb..349ff60 100644
--- a/libglusterfs/src/gfdb/gfdb_sqlite3.c
+++ b/libglusterfs/src/gfdb/gfdb_sqlite3.c
@@ -763,7 +763,7 @@ gf_sqlite3_find_unchanged_for_time (void *db_conn,
                 /*First condition: For writes*/
                 "((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + "
                 GF_COL_TB_WMSEC ") <= ? )"
-                " OR "
+                " AND "
                 /*Second condition: For reads*/
                 "((" GF_COL_TB_RWSEC " * " TOSTRING(GFDB_MICROSEC) " + "
                 GF_COL_TB_RWMSEC ") <= ?)";
@@ -996,7 +996,7 @@ gf_sqlite3_find_unchanged_for_time_freq (void *db_conn,
                 "( (" GF_COL_TB_WFC " < ? ) AND"
                 "((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + "
                 GF_COL_TB_WMSEC ") >= ? ) ) )"
-                " OR "
+                " AND "
                 /*Second condition: For Reads
                  * Files that have read wind time smaller than for_time
                  * OR
-- 
1.7.1