Repository: ignite
Updated Branches:
  refs/heads/master 242b345eb -> 9bf3558c3


IGNITE-6825: SQL: Fixed GridH2Table unlock in case of interrupt. This closes 
#2976.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9bf3558c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9bf3558c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9bf3558c

Branch: refs/heads/master
Commit: 9bf3558c31348b4d6f1ac01a3d667cc289e64462
Parents: 242b345
Author: devozerov <[email protected]>
Authored: Fri Nov 3 14:04:33 2017 +0300
Committer: devozerov <[email protected]>
Committed: Fri Nov 3 14:04:33 2017 +0300

----------------------------------------------------------------------
 .../processors/query/h2/opt/GridH2Table.java        | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9bf3558c/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index ac70c54..c299075 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -243,14 +243,13 @@ public class GridH2Table extends TableBase {
 
     /** {@inheritDoc} */
     @Override public boolean lock(Session ses, boolean exclusive, boolean 
force) {
-        Boolean putRes = sessions.putIfAbsent(ses, exclusive);
+        // In accordance with base method semantics, we'll return true if we 
were already exclusively locked.
+        Boolean res = sessions.get(ses);
 
-        // In accordance with base method semantics, we'll return true if we 
were already exclusively locked
-        if (putRes != null)
-            return putRes;
-
-        ses.addLock(this);
+        if (res != null)
+            return res;
 
+        // Acquire the lock.
         lock(exclusive);
 
         if (destroyed) {
@@ -259,6 +258,11 @@ public class GridH2Table extends TableBase {
             throw new IllegalStateException("Table " + identifierString() + " 
already destroyed.");
         }
 
+        // Mutate state.
+        sessions.put(ses, exclusive);
+
+        ses.addLock(this);
+
         return false;
     }
 

Reply via email to