Closed rockeet closed 5 years ago
另一个问题:创建一个线程,写几条数据,然后退出线程,会导致数量巨大的 Sub-MemTable。 这个问题可以这样解决: 因为每个线程退出时,它对应的 instance_tls 对象会析构,在这个对象的析构过程中,我们可以做一些工作:如果是第一次析构(第一个线程退出),啥都不干,如果是后续其它线程的析构,就尝试与之前析构的线程对应的 instance_tls Sub-MemTable 进行合并。
------ 这个问题优先级较低,先实现其他功能
Done!
Create an
instance-thread-local
Sub-MemTable
for suchMemTable
, suchMemTable
is optimized for write and has read amplification.KeyValue
into itsSub-MemTable
We first implement such
MemTable
on top ofPatriciaTrie
realloc
toshrink_to_fit
, we assumerealloc
will not relocate memory when shrink.xallocx
which is dedicated for resize memory in placeOnce MemTable is not a bottle neck, the advantage of distributed compaction will be shown more...