From 189bbcd82d28f3849b5d09f3e1a530032bcdf20d Mon Sep 17 00:00:00 2001 From: Eliran Sinvani Date: Wed, 23 Feb 2022 20:10:27 +0200 Subject: [PATCH] prepared_statements: Invalidate batch statement too It seams that batch prepared statements always return false for depends_on, this in turn renders the removal criteria from the prepared statements cache to always be false which result by the queries not being evicted. Here we change the function to return the true state meaning, they will return true if one of the sub queries is dependant upon the keyspace and/ or column family. Fixes #10129 Signed-off-by: Eliran Sinvani (cherry picked from commit 4eb03984570a8077c71ffb216ce985bfe5d0b624) --- cql3/statements/batch_statement.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cql3/statements/batch_statement.cc b/cql3/statements/batch_statement.cc index f7337742f3..a6a0e5dae1 100644 --- a/cql3/statements/batch_statement.cc +++ b/cql3/statements/batch_statement.cc @@ -100,7 +100,7 @@ batch_statement::batch_statement(type type_, bool batch_statement::depends_on(std::string_view ks_name, std::optional cf_name) const { - return false; + return boost::algorithm::any_of(_statements, [&ks_name, &cf_name] (auto&& s) { return s.statement->depends_on(ks_name, cf_name); }); } uint32_t batch_statement::get_bound_terms() const