From 75e1d7ea749002ce740e52b29379a46ef8a2a94b Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 2 Sep 2021 20:57:44 +0300 Subject: [PATCH] large_data_handler: Prepare for stopped qctx All the large data handler methods rely on global qctx thing to write down its notes. This creates circular dependency: query processor -> database -> large_data_handler -> qctx -> qp In scylla this is not a technical problem, neither qctx nor the query processor are stopped. It is a problem in cql_test_env that stops everything, including resetting qctx to null. To avoid tests stepping on nullptr qctx add the explicit check. Signed-off-by: Pavel Emelyanov --- db/large_data_handler.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/db/large_data_handler.cc b/db/large_data_handler.cc index 647e4ce35a..299fd6ae54 100644 --- a/db/large_data_handler.cc +++ b/db/large_data_handler.cc @@ -110,6 +110,12 @@ future<> large_data_handler::maybe_delete_large_data_entries(sstables::shared_ss template static future<> try_record(std::string_view large_table, const sstables::sstable& sst, const sstables::key& partition_key, int64_t size, std::string_view desc, std::string_view extra_path, const std::vector &extra_fields, Args&&... args) { + // FIXME This check is for test/cql-test-env that stop qctx (it does so because + // it stops query processor and doesn't want us to access its freed instantes) + if (!db::qctx) { + return make_ready_future<>(); + } + sstring extra_fields_str; sstring extra_values; for (std::string_view field : extra_fields) {