diff options
author | Mohammad Salehe <salehe@cs.toronto.edu> | 2019-02-08 11:23:33 -0500 |
---|---|---|
committer | Mohammad Salehe <salehe@cs.toronto.edu> | 2019-02-24 22:23:39 -0500 |
commit | 4fd976522e547261d24b062d5bb21a793887c3d3 (patch) | |
tree | af3425115e7ad026b91bfb5300cbff740e0469e7 /src/main/java | |
parent | dee199dd21b286e4c9e3af36fbc0d646168615e4 (diff) |
Add "ORDER BY" to top of lock queue checks
Add explicit "ORDER BY" to top of lock queue check queries
Change-Id: Ibb985d21283cd952e609b8fbb8d78194f5891d60
Issue-ID: MUSIC-148
Signed-off-by: Mohammad Salehe <salehe@cs.toronto.edu>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java b/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java index cbc172db..6e0b61a0 100644 --- a/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java +++ b/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java @@ -214,7 +214,7 @@ public class CassaLockStore { logger.info(EELFLoggerDelegate.applicationLogger, "Peek in lock table for " + keyspace+"."+table+"."+key); table = table_prepend_name+table; - String selectQuery = "select * from "+keyspace+"."+table+" where key='"+key+"' LIMIT 1;"; + String selectQuery = "SELECT * FROM "+keyspace+"."+table+" WHERE key='"+key+"' ORDER BY lockReference ASC LIMIT 1;"; PreparedQueryObject queryObject = new PreparedQueryObject(); queryObject.appendQueryString(selectQuery); ResultSet results = dsHandle.executeOneConsistencyGet(queryObject); @@ -238,7 +238,7 @@ public class CassaLockStore { "Checking in lock table for " + keyspace + "." + table + "." + key); table = table_prepend_name + table; String selectQuery = - "select * from " + keyspace + "." + table + " where key='" + key + "';"; + "SELECT * FROM " + keyspace + "." + table + " WHERE key='" + key + "' ORDER BY lockReference ASC;"; PreparedQueryObject queryObject = new PreparedQueryObject(); queryObject.appendQueryString(selectQuery); ResultSet rs = dsHandle.executeOneConsistencyGet(queryObject); |