diff --git a/cql3/Cql.g b/cql3/Cql.g index ef9e0f908f..b9b805ca10 100644 --- a/cql3/Cql.g +++ b/cql3/Cql.g @@ -1332,7 +1332,7 @@ setOrMapLiteral[shared_ptr t] returns [shared_ptr(std::move(m)); } | { s.push_back(t); } ( ',' tn=term { s.push_back(tn); } )* - { $value = make_shared(cql3::sets::literal(std::move(s))); } + { $value = ::make_shared(std::move(s)); } ; collectionLiteral returns [shared_ptr value] @@ -1343,7 +1343,7 @@ collectionLiteral returns [shared_ptr value] | '{' t=term v=setOrMapLiteral[t] { $value = v; } '}' // Note that we have an ambiguity between maps and set for "{}". So we force it to a set literal, // and deal with it later based on the type of the column (SetLiteral.java). - | '{' '}' { $value = make_shared(cql3::sets::literal({})); } + | '{' '}' { $value = ::make_shared(std::vector>()); } ; usertypeLiteral returns [shared_ptr ut] diff --git a/cql3/cql3_type.cc b/cql3/cql3_type.cc index f9c7583b9e..6e4534eeb9 100644 --- a/cql3/cql3_type.cc +++ b/cql3/cql3_type.cc @@ -348,22 +348,22 @@ cql3_type::raw::user_type(ut_name name) { shared_ptr cql3_type::raw::map(shared_ptr t1, shared_ptr t2) { - return make_shared(raw_collection(abstract_type::kind::map, std::move(t1), std::move(t2))); + return ::make_shared(abstract_type::kind::map, std::move(t1), std::move(t2)); } shared_ptr cql3_type::raw::list(shared_ptr t) { - return make_shared(raw_collection(abstract_type::kind::list, {}, std::move(t))); + return ::make_shared(abstract_type::kind::list, nullptr, std::move(t)); } shared_ptr cql3_type::raw::set(shared_ptr t) { - return make_shared(raw_collection(abstract_type::kind::set, {}, std::move(t))); + return ::make_shared(abstract_type::kind::set, nullptr, std::move(t)); } shared_ptr cql3_type::raw::tuple(std::vector> ts) { - return make_shared(raw_tuple(std::move(ts))); + return ::make_shared(std::move(ts)); } shared_ptr diff --git a/cql3/functions/functions.cc b/cql3/functions/functions.cc index e7d91189c2..496b3b537c 100644 --- a/cql3/functions/functions.cc +++ b/cql3/functions/functions.cc @@ -486,17 +486,17 @@ function_call::make_terminal(shared_ptr fun, cql3::raw_value result, c return visit(*fun->return_type(), make_visitor( [&] (const list_type_impl& ltype) -> shared_ptr { - return make_shared(lists::value::from_serialized(to_buffer(result), ltype, sf)); + return make_shared(lists::value::from_serialized(to_buffer(result), ltype, sf)); }, [&] (const set_type_impl& stype) -> shared_ptr { - return make_shared(sets::value::from_serialized(to_buffer(result), stype, sf)); + return make_shared(sets::value::from_serialized(to_buffer(result), stype, sf)); }, [&] (const map_type_impl& mtype) -> shared_ptr { - return make_shared(maps::value::from_serialized(to_buffer(result), mtype, sf)); + return make_shared(maps::value::from_serialized(to_buffer(result), mtype, sf)); }, [&] (const user_type_impl& utype) -> shared_ptr { // TODO (kbraun): write a test for this case when User Defined Functions are implemented - return make_shared(user_types::value::from_serialized(to_buffer(result), utype)); + return make_shared(user_types::value::from_serialized(to_buffer(result), utype)); }, [&] (const abstract_type& type) -> shared_ptr { if (type.is_collection()) { diff --git a/cql3/lists.cc b/cql3/lists.cc index 2bdab8b196..c361814870 100644 --- a/cql3/lists.cc +++ b/cql3/lists.cc @@ -81,7 +81,7 @@ lists::literal::prepare(database& db, const sstring& keyspace, lw_shared_ptr(std::move(value)); } } @@ -236,7 +236,7 @@ lists::marker::bind(const query_options& options) { try { return with_linearized(*value, [&] (bytes_view v) { ltype.validate(v, options.get_cql_serialization_format()); - return make_shared(value::from_serialized(v, ltype, options.get_cql_serialization_format())); + return make_shared(value::from_serialized(v, ltype, options.get_cql_serialization_format())); }); } catch (marshal_exception& e) { throw exceptions::invalid_request_exception(e.what()); diff --git a/cql3/maps.cc b/cql3/maps.cc index a7b1efb01c..a82e7792cf 100644 --- a/cql3/maps.cc +++ b/cql3/maps.cc @@ -92,7 +92,7 @@ maps::literal::prepare(database& db, const sstring& keyspace, lw_shared_ptr(std::move(value)); } } @@ -269,7 +269,7 @@ maps::marker::bind(const query_options& options) { } catch (marshal_exception& e) { throw exceptions::invalid_request_exception(e.what()); } - return ::make_shared(maps::value::from_serialized(*val, static_cast(*_receiver->type), options.get_cql_serialization_format())); + return ::make_shared(maps::value::from_serialized(*val, static_cast(*_receiver->type), options.get_cql_serialization_format())); } void diff --git a/cql3/multi_column_relation.hh b/cql3/multi_column_relation.hh index 0bf7be2dc6..df2993f262 100644 --- a/cql3/multi_column_relation.hh +++ b/cql3/multi_column_relation.hh @@ -64,6 +64,8 @@ private: std::vector> _in_values; shared_ptr _in_marker; +public: + multi_column_relation(std::vector> entities, const operator_type& relation_type, shared_ptr values_or_marker, std::vector> in_values, shared_ptr in_marker) @@ -78,11 +80,10 @@ private: std::vector> entities, const operator_type& relation_type, shared_ptr values_or_marker, std::vector> in_values, shared_ptr in_marker) { - return ::make_shared(multi_column_relation(std::move(entities), relation_type, std::move(values_or_marker), - std::move(in_values), std::move(in_marker))); + return ::make_shared(std::move(entities), relation_type, std::move(values_or_marker), + std::move(in_values), std::move(in_marker)); } -public: /** * Creates a multi-column EQ, LT, LTE, GT, or GTE relation. * For example: "SELECT ... WHERE (a, b) > (0, 1)" diff --git a/cql3/sets.cc b/cql3/sets.cc index f11ea418d1..e21045db47 100644 --- a/cql3/sets.cc +++ b/cql3/sets.cc @@ -245,7 +245,7 @@ sets::marker::bind(const query_options& options) { } catch (marshal_exception& e) { throw exceptions::invalid_request_exception(e.what()); } - return make_shared(value::from_serialized(*value, type, options.get_cql_serialization_format())); + return make_shared(value::from_serialized(*value, type, options.get_cql_serialization_format())); } } diff --git a/cql3/single_column_relation.hh b/cql3/single_column_relation.hh index 1760910ec8..f72ef02705 100644 --- a/cql3/single_column_relation.hh +++ b/cql3/single_column_relation.hh @@ -66,7 +66,7 @@ private: ::shared_ptr _map_key; ::shared_ptr _value; std::vector<::shared_ptr> _in_values; -private: +public: single_column_relation(::shared_ptr entity, ::shared_ptr map_key, const operator_type& type, ::shared_ptr value, std::vector<::shared_ptr> in_values) : relation(type) @@ -75,7 +75,7 @@ private: , _value(std::move(value)) , _in_values(std::move(in_values)) { } -public: + /** * Creates a new relation. * @@ -102,7 +102,7 @@ public: static ::shared_ptr create_in_relation(::shared_ptr entity, std::vector<::shared_ptr> in_values) { - return ::make_shared(single_column_relation(std::move(entity), {}, operator_type::IN, {}, std::move(in_values))); + return ::make_shared(std::move(entity), nullptr, operator_type::IN, nullptr, std::move(in_values)); } ::shared_ptr get_entity() { @@ -190,8 +190,8 @@ protected: virtual ::shared_ptr maybe_rename_identifier(const column_identifier::raw& from, column_identifier::raw to) override { return *_entity == from - ? ::make_shared(single_column_relation( - ::make_shared(std::move(to)), _map_key, _relation_type, _value, _in_values)) + ? ::make_shared( + ::make_shared(std::move(to)), _map_key, _relation_type, _value, _in_values) : static_pointer_cast(shared_from_this()); } diff --git a/cql3/statements/batch_statement.cc b/cql3/statements/batch_statement.cc index 63f7998a86..6fde260346 100644 --- a/cql3/statements/batch_statement.cc +++ b/cql3/statements/batch_statement.cc @@ -454,7 +454,7 @@ batch_statement::prepare(database& db, cql_stats& stats) { if (!have_multiple_cfs && batch_statement_.get_statements().size() > 0) { partition_key_bind_indices = bound_names.get_partition_key_bind_indexes(*batch_statement_.get_statements()[0].statement->s); } - return std::make_unique(make_shared(std::move(batch_statement_)), + return std::make_unique(make_shared(std::move(batch_statement_)), bound_names.get_specifications(), std::move(partition_key_bind_indices)); } diff --git a/cql3/statements/update_statement.cc b/cql3/statements/update_statement.cc index 8316f3b7e9..c251239940 100644 --- a/cql3/statements/update_statement.cc +++ b/cql3/statements/update_statement.cc @@ -139,7 +139,7 @@ void update_statement::add_update_for_key(mutation& m, const query::clustering_r if (rb->name().empty() || rb->type == empty_type) { // There is no column outside the PK. So no operation could have passed through validation assert(_column_operations.empty()); - constants::setter(*s->regular_begin(), make_shared(constants::value(cql3::raw_value::make_value(bytes())))).execute(m, prefix, params); + constants::setter(*s->regular_begin(), make_shared(cql3::raw_value::make_value(bytes()))).execute(m, prefix, params); } else { // dense means we don't have a row marker, so don't accept to set only the PK. See CASSANDRA-5648. if (_column_operations.empty()) { @@ -217,19 +217,19 @@ insert_prepared_json_statement::execute_set_value(mutation& m, const clustering_ visit(*column.type, make_visitor( [&] (const list_type_impl& ltype) { lists::setter::execute(m, prefix, params, column, - ::make_shared(lists::value::from_serialized(fragmented_temporary_buffer::view(*value), ltype, sf))); + ::make_shared(lists::value::from_serialized(fragmented_temporary_buffer::view(*value), ltype, sf))); }, [&] (const set_type_impl& stype) { sets::setter::execute(m, prefix, params, column, - ::make_shared(sets::value::from_serialized(fragmented_temporary_buffer::view(*value), stype, sf))); + ::make_shared(sets::value::from_serialized(fragmented_temporary_buffer::view(*value), stype, sf))); }, [&] (const map_type_impl& mtype) { maps::setter::execute(m, prefix, params, column, - ::make_shared(maps::value::from_serialized(fragmented_temporary_buffer::view(*value), mtype, sf))); + ::make_shared(maps::value::from_serialized(fragmented_temporary_buffer::view(*value), mtype, sf))); }, [&] (const user_type_impl& utype) { user_types::setter::execute(m, prefix, params, column, - ::make_shared(user_types::value::from_serialized(fragmented_temporary_buffer::view(*value), utype))); + ::make_shared(user_types::value::from_serialized(fragmented_temporary_buffer::view(*value), utype))); }, [&] (const abstract_type& type) { if (type.is_collection()) { diff --git a/cql3/tuples.cc b/cql3/tuples.cc index 342321d64d..7d73cf5f2a 100644 --- a/cql3/tuples.cc +++ b/cql3/tuples.cc @@ -51,7 +51,7 @@ tuples::literal::prepare(database& db, const sstring& keyspace, lw_shared_ptr(std::move(value)); } } @@ -76,7 +76,7 @@ tuples::literal::prepare(database& db, const sstring& keyspace, const std::vecto if (all_terminal) { return value.bind(query_options::DEFAULT); } else { - return make_shared(std::move(value)); + return make_shared(std::move(value)); } } @@ -153,7 +153,7 @@ shared_ptr tuples::in_marker::bind(const query_options& options) { } catch (marshal_exception& e) { throw exceptions::invalid_request_exception(e.what()); } - return make_shared(tuples::in_value::from_serialized(*value, type, options)); + return make_shared(tuples::in_value::from_serialized(*value, type, options)); } } diff --git a/cql3/tuples.hh b/cql3/tuples.hh index d52a807187..863f784da6 100644 --- a/cql3/tuples.hh +++ b/cql3/tuples.hh @@ -323,7 +323,7 @@ public: } catch (marshal_exception& e) { throw exceptions::invalid_request_exception(e.what()); } - return make_shared(value::from_serialized(*value, type)); + return make_shared(value::from_serialized(*value, type)); } } }; diff --git a/cql3/user_types.cc b/cql3/user_types.cc index a80ee71917..9a5f63e2ef 100644 --- a/cql3/user_types.cc +++ b/cql3/user_types.cc @@ -105,7 +105,7 @@ shared_ptr user_types::literal::prepare(database& db, const sstring& keysp if (all_terminal) { return value.bind(query_options::DEFAULT); } else { - return make_shared(std::move(value)); + return make_shared(std::move(value)); } } @@ -238,7 +238,7 @@ shared_ptr user_types::marker::bind(const query_options& options) { if (value.is_unset_value()) { return constants::UNSET_VALUE; } - return make_shared(value::from_serialized(*value, static_cast(*_receiver->type))); + return make_shared(value::from_serialized(*value, static_cast(*_receiver->type))); } void user_types::setter::execute(mutation& m, const clustering_key_prefix& row_key, const update_parameters& params) { diff --git a/main.cc b/main.cc index 4895e90087..c2550a453f 100644 --- a/main.cc +++ b/main.cc @@ -413,7 +413,8 @@ static auto defer_verbose_shutdown(const char* what, Func&& func) { startlog.info("Shutting down {} was successful", what); }; - return ::make_shared(deferred_action(std::move(vfunc))); + auto ret = deferred_action(std::move(vfunc)); + return ::make_shared(std::move(ret)); } int main(int ac, char** av) { diff --git a/schema.cc b/schema.cc index ca2fbfdf17..fb106ee4aa 100644 --- a/schema.cc +++ b/schema.cc @@ -286,7 +286,7 @@ void schema::rebuild() { } _v3_columns = v3_columns::from_v2_schema(*this); - _full_slice = make_shared(partition_slice_builder(*this).build()); + _full_slice = make_shared(partition_slice_builder(*this).build()); } const column_mapping& schema::get_column_mapping() const { diff --git a/seastarx.hh b/seastarx.hh index 8c424816bd..be002be49a 100644 --- a/seastarx.hh +++ b/seastarx.hh @@ -28,9 +28,6 @@ namespace seastar { template class shared_ptr; -template -shared_ptr make_shared(T&&); - template shared_ptr make_shared(A&&... a);