row_cache: Fix crash on memtable flush with LCS

Presence checker is constructed and destroyed in the standard
allocator context, but the presence check was invoked in the LSA
context. If the presence checker allocates and caches some managed
objects, there will be alloc-dealloc mismatch.

That is the case with LeveledCompactionStrategy, which uses
incremental_selector.

Fix by invoking the presence check in the standard allocator context.

Fixes #4063.

Message-Id: <1547547700-16599-1-git-send-email-tgrabiec@scylladb.com>
(cherry picked from commit 32f711ce56)
This commit is contained in:
Tomasz Grabiec
2019-01-15 11:21:40 +01:00
committed by Avi Kivity
parent d427a23d42
commit 2d181da656
2 changed files with 43 additions and 1 deletions

View File

@@ -1029,7 +1029,9 @@ future<> row_cache::update(external_updater eu, memtable& m) {
_tracker.on_partition_merge();
return entry.partition().apply_to_incomplete(*_schema, std::move(mem_e.partition()), *mem_e.schema(), _tracker.memtable_cleaner(),
alloc, _tracker.region(), _tracker, _underlying_phase, acc);
} else if (cache_i->continuous() || is_present(mem_e.key()) == partition_presence_checker_result::definitely_doesnt_exist) {
} else if (cache_i->continuous()
|| with_allocator(standard_allocator(), [&] { return is_present(mem_e.key()); })
== partition_presence_checker_result::definitely_doesnt_exist) {
// Partition is absent in underlying. First, insert a neutral partition entry.
cache_entry* entry = current_allocator().construct<cache_entry>(cache_entry::evictable_tag(),
_schema, dht::decorated_key(mem_e.key()),