Alexander Lapin created IGNITE-17811:
----------------------------------------

             Summary: Implement efficient way to retrieve locks by txId
                 Key: IGNITE-17811
                 URL: https://issues.apache.org/jira/browse/IGNITE-17811
             Project: Ignite
          Issue Type: Improvement
            Reporter: Alexander Lapin


org.apache.ignite.internal.tx.impl.HeapLockManager#locks require better 
implementation that'll use index or similar instead of full locks set 
iteration. 
{code:java}
public Iterator<Lock> locks(UUID txId) {
    // TODO: tmp, use index instead.
    List<Lock> result = new ArrayList<>();

    for (Map.Entry<LockKey, LockState> entry : locks.entrySet()) {
        Waiter waiter = entry.getValue().waiter(txId);

        if (waiter != null) {
            result.add(
                    new Lock(
                            entry.getKey(),
                            waiter.lockMode(),
                            txId
                    )
            );
        }
    }

    return result.iterator();
}{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to