ascherbakoff commented on code in PR #2720:
URL: https://github.com/apache/ignite-3/pull/2720#discussion_r1421723391


##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/HeapLockManager.java:
##########
@@ -51,53 +55,121 @@
 import org.apache.ignite.internal.tx.event.LockEvent;
 import org.apache.ignite.internal.tx.event.LockEventParameters;
 import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
 
 /**
  * A {@link LockManager} implementation which stores lock queues in the heap.
  *
  * <p>Lock waiters are placed in the queue, ordered according to comparator 
provided by {@link HeapLockManager#deadlockPreventionPolicy}.
- * When a new waiter is placed in the queue, it's validated against current 
lock owner: if there is an owner with a higher transaction id
- * lock request is denied.
+ * When a new waiter is placed in the queue, it's validated against current 
lock owner: if there is an owner with a higher priority (as
+ * defined by comparator) lock request is denied.
  *
  * <p>Read lock can be upgraded to write lock (only available for the lowest 
read-locked entry of
  * the queue).
+ *
+ * <p>Additionally limits the lock map size.
  */
 public class HeapLockManager extends AbstractEventProducer<LockEvent, 
LockEventParameters> implements LockManager {
-    private ConcurrentHashMap<LockKey, LockState> locks = new 
ConcurrentHashMap<>();
+    /**
+     * Table size. TODO make it configurable IGNITE-20694
+     */
+    public static final int SLOTS = 131072; //16536;

Review Comment:
   Removed 16536, thisi is a debugging artifact. 
   131072 is a default size of lock table, which seems reasonable to me. It 
must be power of two.



##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/HeapLockManager.java:
##########
@@ -51,53 +55,121 @@
 import org.apache.ignite.internal.tx.event.LockEvent;
 import org.apache.ignite.internal.tx.event.LockEventParameters;
 import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
 
 /**
  * A {@link LockManager} implementation which stores lock queues in the heap.
  *
  * <p>Lock waiters are placed in the queue, ordered according to comparator 
provided by {@link HeapLockManager#deadlockPreventionPolicy}.
- * When a new waiter is placed in the queue, it's validated against current 
lock owner: if there is an owner with a higher transaction id
- * lock request is denied.
+ * When a new waiter is placed in the queue, it's validated against current 
lock owner: if there is an owner with a higher priority (as
+ * defined by comparator) lock request is denied.
  *
  * <p>Read lock can be upgraded to write lock (only available for the lowest 
read-locked entry of
  * the queue).
+ *
+ * <p>Additionally limits the lock map size.
  */
 public class HeapLockManager extends AbstractEventProducer<LockEvent, 
LockEventParameters> implements LockManager {
-    private ConcurrentHashMap<LockKey, LockState> locks = new 
ConcurrentHashMap<>();
+    /**
+     * Table size. TODO make it configurable IGNITE-20694
+     */
+    public static final int SLOTS = 131072; //16536;

Review Comment:
   Removed 16536, this is a debugging artifact. 
   131072 is a default size of lock table, which seems reasonable to me. It 
must be power of two.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to