diff --git a/replica/database.cc b/replica/database.cc index a69214280fa7..ed614fd29a5c 100644 --- a/replica/database.cc +++ b/replica/database.cc @@ -39,6 +39,7 @@ #include #include #include "mutation/frozen_mutation.hh" +#include "mutation/async_utils.hh" #include #include "service/migration_listener.hh" #include "cell_locking.hh" @@ -1808,6 +1809,14 @@ future<> database::apply_in_memory(const frozen_mutation& m, schema_ptr m_schema data_listeners().on_write(m_schema, m); + if (m.representation().size() > 128*1024) { + return unfreeze_gently(m, std::move(m_schema)).then([&cf, h = std::move(h), timeout] (auto m) mutable { + return do_with(std::move(m), [&cf, h = std::move(h), timeout] (auto& m) mutable { + return cf.apply(m, std::move(h), timeout); + }); + }); + } + return cf.apply(m, std::move(m_schema), std::move(h), timeout); }