vanilladb / vanillacore

The core engine of VanillaDB
Apache License 2.0
196 stars 41 forks source link

A series of optimization for buffer & index #78

Closed pin-yu closed 2 years ago

pin-yu commented 2 years ago

Basically, each commit is corresponding to an optimization or a revision.

  1. I cache whether the index file size is non-empty.
  2. I reduce a redundant call of getting blockId.
  3. I change the synchronized block in bufferPoolMgr.pin() to reentrant lock, and shrink the critical section.
  4. I rename "Buffer.externalLock" to "Buffer.swapLock".
  5. I remove some locks in Buffer, because the swap lock has guarantees the concurrent correctness.
  6. I persist index-root buffer in BufferPoolMgr, which means that buffer won't be swapped.

Here are what we need to check

a. Is it safe to remove lock for Buffer.blockId?