Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary cloning in BufferMgr.unpinAll #51

Open
SLMT opened this issue May 16, 2020 · 0 comments
Open

Unnecessary cloning in BufferMgr.unpinAll #51

SLMT opened this issue May 16, 2020 · 0 comments

Comments

@SLMT
Copy link
Member

SLMT commented May 16, 2020

There is an unnecessary cloning in org.vanilladb.core.storage.buffer.BufferMgr. Here is the code snippet:

private void unpinAll(Transaction tx) {
	// Copy the set of pinned buffers to avoid ConcurrentModificationException
	Set<PinningBuffer> pinnedBuffs = new HashSet<PinningBuffer>(pinningBuffers.values());
	if (pinnedBuffs != null) {
		for (PinningBuffer pinnedBuff : pinnedBuffs)
			bufferPool.unpin(pinnedBuff.buffer);
	}

	synchronized (bufferPool) {
		bufferPool.notifyAll();
	}
}

This may be a legacy code that used to prevent ConcurrentModificationExeception, but this became unnecessary as we updated the logic of the code in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant