Skip to content

[Cleanup] Delete the InsertionLock class and node lock methods #41

Description

@thep2p

Summary

Completes removal of the pessimistic insertion lock. Under Aspnes & Shah, "Skip Graphs" (arXiv:cs/0306043), Algorithm 2 joins a node lock-free by order-verification forwarding, so no node-level lock is needed. Once the lock-coordination RPCs and the locked-retry transport have been removed, the InsertionLock class, the node's lock methods, and the leftover backoff / locked packet fields are unreferenced scaffolding.

This issue deletes that scaffolding and the dead version guard.

Scope

  • src/main/java/skipnode/InsertionLock.java — delete the whole file (the Semaphore-based lock, startInsertion / endInsertion, tryAcquire / unlockOwned, isLocked / isLockedBy, the holder / owner fields, and the nested NeighborInstance class).
  • src/main/java/skipnode/SkipNode.java:
    • Remove the InsertionLock / NeighborInstance import, the insertionLock and ownedLocks fields, the insertionLock.startInsertion() call in the constructor, and the insertionLock.endInsertion() calls in insert().
    • Remove the tryAcquire(SkipNodeIdentity), unlock(SkipNodeIdentity), isLocked(), and isLockedBy(String, int) overrides.
    • Remove the dead version guard from the old tryAcquire path (the version != this.version self-comparison, which compares the field to itself and is always false), and remove the now write-only version field together with its version++ increment in insertIntoTable(...).
    • Simplify isAvailable() to return inserted (drop the insertionLock.isLocked() term).
    • Remove any residual lock scaffolding left in the insertion path after the lock-free join rewrite (e.g. an acquireNeighborLocks(...) method or ownedLocks bookkeeping), if still present.
  • src/main/java/skipnode/SkipNodeInterface.java — remove the unlock, tryAcquire, isLocked, and isLockedBy method declarations.
  • src/main/java/underlay/packets/Request.java — remove the now-unused backoff field and its comment.
  • src/main/java/underlay/packets/Response.java — remove the now-unused locked field and the Response(boolean) constructor, keeping the no-arg constructor.

Acceptance Criteria

  • InsertionLock.java is deleted; no source file imports or references InsertionLock or NeighborInstance.
  • SkipNode has no insertionLock / ownedLocks fields and no tryAcquire / unlock / isLocked / isLockedBy methods; SkipNodeInterface no longer declares them.
  • isAvailable() returns inserted.
  • The version field, its increment, and the self-comparison guard are gone.
  • Request no longer has a backoff field and Response no longer has a locked field or Response(boolean) constructor; a repo-wide search finds no references to request.backoff or response.locked.
  • A repo-wide search finds no remaining references to InsertionLock, startInsertion, endInsertion, unlockOwned, insertionLock, or isLockedBy.
  • The project compiles and the existing test suite passes with no new failures.
  • A new deterministic test asserts that a freshly constructed node reports isAvailable() == false before insertion and isAvailable() == true after its insertion completes.

Dependencies

  • Requires the lock-free join rewrite (Algorithm 2) to have landed, so the insertion path no longer uses these lock methods.
  • Requires the prior cleanup that removed the AcquireLock / ReleaseLock / IsAvailable RPCs and the locked-retry routing gates (which were the consumers of these methods and the last readers of the backoff / locked fields); without it, this change does not compile.

Part of #33. Depends on: #40

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions