Good day, Zhiguo. Here’s my attempt to organise link to previous record without messing with xlog buffers: - link is stored in lock-free hash table instead. I don’t claim it is any better than using xlog buffers. It is just alternative vision. Some tricks in implementation: - Relying on byte-position nature, it could be converted to 32 bit unique value with `(uint32)(pos ^ (pos>>32))`. Certainly it is not totally unique, but it is certainly unique among 32GB consecutive log. - PrevBytePos could be calculated as a difference between positions, and this difference is certainly less than 4GB, so it also could be stored as 32 bit value (PrevSize). - Since xlog records are aligned we could use lowest bit of PrevSize as a lock. - While Cuckoo Hashing could suffer from un-solvable cycle conflicts, this implementation relies on concurrent deleters which will eventually break such cycles if any. I have a version without 32bit conversion trick, and it is a bit lighter on atomic instructions count, but it performs badly in absence of native 64bit atomics. —— regards Yura Sokolov aka funny-falcon |
v1-0001-Lock-free-XLog-Reservation-using-lock-free-hash-t.patch
Description: Binary data