mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-09 16:33:35 +00:00
It is currently possible that _memtables->add_memtable() will throw after _memtables->clear(), leaving the memtables list completely empty. However, we do rely on always having at least one allocated in the memtables list as active_memtable() references a lw_shared_ptr<memtable> at the back of the memtables vector, and it expected to always be allocated via add_memtable() upon construction and after clear(). This change moves the implementation of this convention to memtable_list::clear() and makes the latter exception safe by first allocating the to-be-added empty memtable and only then clearing the vector. Refs #8749 Test: unit(dev) Signed-off-by: Benny Halevy <bhalevy@scylladb.com> Message-Id: <20210530100232.2104051-1-bhalevy@scylladb.com>
69 KiB
69 KiB