Skip to content

Commit

Permalink
Add additional javadoc for SlaveLocksClient and for SlaveStatementLocks
Browse files Browse the repository at this point in the history
after review
  • Loading branch information
MishaDemianenko committed Jul 17, 2017
1 parent b3c5aa2 commit 556ce42
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,17 @@ public long activeLockCount()
return client.activeLockCount();
}

/**
* In order to prevent various indexes collisions on master during transaction commit that originate on one of the
* slaves we need to grab same locks on {@link ResourceTypes#LABEL} and {@link ResourceTypes#RELATIONSHIP_TYPE}
* that
* where obtained on origin. To be able to do that and also prevent shared locks to be propagates to master in cases
* of
* read only transactions we need to postpone obtaining them till we know that we participating in a
* transaction that performs modifications.
*
* @param tracer lock tracer
*/
void acquireDeferredSharedLocks( LockTracer tracer )
{
assertNotStopped();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,20 @@
import org.neo4j.kernel.impl.locking.ActiveLock;
import org.neo4j.kernel.impl.locking.LockTracer;
import org.neo4j.kernel.impl.locking.Locks;
import org.neo4j.kernel.impl.locking.ResourceTypes;
import org.neo4j.kernel.impl.locking.StatementLocks;

/**
* Slave specific statement locks that in addition to standard functionality provided by configured delegate
* will grab selected shared locks on master during prepareForCommit phase.
* <p>
* In order to prevent various indexes collisions on master during transaction commit that originate on one of the
* slaves we need to grab same locks on {@link ResourceTypes#LABEL} and {@link ResourceTypes#RELATIONSHIP_TYPE} that
* where obtained on origin. To be able to do that and also prevent shared locks to be propagates to master in cases of
* read only transactions we will postpone obtaining them till we know that we participating in a
* transaction that performs modifications. That's why we will obtain them only as
* part of {@link #prepareForCommit(LockTracer)} call.
* </p>
*/
public class SlaveStatementLocks implements StatementLocks
{
Expand Down

0 comments on commit 556ce42

Please sign in to comment.