mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 10:00:35 +00:00
Prepared LIST statements were not calculating metadata in PREPARE path, and sent empty string hash to client causing problematic behaviour where metadat_id was not recalculated correctly. This patch moves metadata construction into get_result_metadata() for the affected LIST statements and reuse that metadata when building the result set. This gives PREPARE a stable metadata id for LIST ROLES, LIST USERS, LIST PERMISSIONS and the service-level variants. This patch also adds a new boost test that verifies that when an EXECUTE request carries an empty result metadata id while the server has a real metadata id for the result set, the response is marked METADATA_CHANGED and includes the full result metadata plus the server metadata id. This covers the recovery path for clients that send an empty or otherwise unusable metadata id instead of a matching cached one.
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
/*
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*
|
|
* Modified by ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: (LicenseRef-ScyllaDB-Source-Available-1.1 and Apache-2.0)
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "types/types.hh"
|
|
|
|
namespace cql3 {
|
|
|
|
class column_identifier;
|
|
|
|
class column_specification final {
|
|
public:
|
|
const sstring ks_name;
|
|
const sstring cf_name;
|
|
const ::shared_ptr<column_identifier> name;
|
|
const data_type type;
|
|
|
|
column_specification(std::string_view ks_name_, std::string_view cf_name_, ::shared_ptr<column_identifier> name_, data_type type_);
|
|
|
|
/**
|
|
* Returns a new <code>ColumnSpecification</code> for the same column but with the specified alias.
|
|
*
|
|
* @param alias the column alias
|
|
* @return a new <code>ColumnSpecification</code> for the same column but with the specified alias.
|
|
*/
|
|
lw_shared_ptr<column_specification> with_alias(::shared_ptr<column_identifier> alias) {
|
|
return make_lw_shared<column_specification>(ks_name, cf_name, alias, type);
|
|
}
|
|
|
|
bool is_reversed_type() const {
|
|
return ::dynamic_pointer_cast<const reversed_type_impl>(type) != nullptr;
|
|
}
|
|
|
|
static bool all_in_same_table(const std::vector<lw_shared_ptr<column_specification>>& names);
|
|
};
|
|
|
|
lw_shared_ptr<column_specification> make_column_spec(std::string_view ks_name, std::string_view cf_name, sstring name, data_type type);
|
|
|
|
}
|