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 <xemul@scylladb.com>
This commit is contained in:
Pavel Emelyanov
2021-09-02 20:57:44 +03:00
parent bb23986826
commit 75e1d7ea74

View File

@@ -110,6 +110,12 @@ future<> large_data_handler::maybe_delete_large_data_entries(sstables::shared_ss
template <typename... Args>
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<sstring> &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) {