Merge "Don't depend on seastar::make_(lw_)?shared idiosyncrasies" from Rafael

"
While working on another patch I was getting odd compiler errors
saying that a call to ::make_shared was ambiguous. The reason was that
seastar has both:

template <typename T, typename... A>
shared_ptr<T> make_shared(A&&... a);

template <typename T>
shared_ptr<T> make_shared(T&& a);

The second variant doesn't exist in std::make_shared.

This series drops the dependency in scylla, so that a future change
can make seastar::make_shared a bit more like std::make_shared.
"

* 'espindola/make_shared' of https://github.com/espindola/scylla:
  Everywhere: Explicitly instantiate make_lw_shared
  Everywhere: Add a make_shared_schema helper
  Everywhere: Explicitly instantiate make_shared
  cql3: Add a create_multi_column_relation helper
  main: Return a shared_ptr from defer_verbose_shutdown
This commit is contained in:
Avi Kivity
2020-08-02 19:51:24 +03:00
43 changed files with 319 additions and 297 deletions

View File

@@ -1332,7 +1332,7 @@ setOrMapLiteral[shared_ptr<cql3::term::raw> t] returns [shared_ptr<cql3::term::r
{ $value = ::make_shared<cql3::maps::literal>(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<cql3::sets::literal>(std::move(s)); }
;
collectionLiteral returns [shared_ptr<cql3::term::raw> value]
@@ -1343,7 +1343,7 @@ collectionLiteral returns [shared_ptr<cql3::term::raw> 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<cql3::sets::literal>(std::vector<shared_ptr<cql3::term::raw>>()); }
;
usertypeLiteral returns [shared_ptr<cql3::user_types::literal> ut]

View File

@@ -348,22 +348,22 @@ cql3_type::raw::user_type(ut_name name) {
shared_ptr<cql3_type::raw>
cql3_type::raw::map(shared_ptr<raw> t1, shared_ptr<raw> t2) {
return make_shared(raw_collection(abstract_type::kind::map, std::move(t1), std::move(t2)));
return ::make_shared<raw_collection>(abstract_type::kind::map, std::move(t1), std::move(t2));
}
shared_ptr<cql3_type::raw>
cql3_type::raw::list(shared_ptr<raw> t) {
return make_shared(raw_collection(abstract_type::kind::list, {}, std::move(t)));
return ::make_shared<raw_collection>(abstract_type::kind::list, nullptr, std::move(t));
}
shared_ptr<cql3_type::raw>
cql3_type::raw::set(shared_ptr<raw> t) {
return make_shared(raw_collection(abstract_type::kind::set, {}, std::move(t)));
return ::make_shared<raw_collection>(abstract_type::kind::set, nullptr, std::move(t));
}
shared_ptr<cql3_type::raw>
cql3_type::raw::tuple(std::vector<shared_ptr<raw>> ts) {
return make_shared(raw_tuple(std::move(ts)));
return ::make_shared<raw_tuple>(std::move(ts));
}
shared_ptr<cql3_type::raw>

View File

@@ -486,17 +486,17 @@ function_call::make_terminal(shared_ptr<function> fun, cql3::raw_value result, c
return visit(*fun->return_type(), make_visitor(
[&] (const list_type_impl& ltype) -> shared_ptr<terminal> {
return make_shared(lists::value::from_serialized(to_buffer(result), ltype, sf));
return make_shared<lists::value>(lists::value::from_serialized(to_buffer(result), ltype, sf));
},
[&] (const set_type_impl& stype) -> shared_ptr<terminal> {
return make_shared(sets::value::from_serialized(to_buffer(result), stype, sf));
return make_shared<sets::value>(sets::value::from_serialized(to_buffer(result), stype, sf));
},
[&] (const map_type_impl& mtype) -> shared_ptr<terminal> {
return make_shared(maps::value::from_serialized(to_buffer(result), mtype, sf));
return make_shared<maps::value>(maps::value::from_serialized(to_buffer(result), mtype, sf));
},
[&] (const user_type_impl& utype) -> shared_ptr<terminal> {
// 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>(user_types::value::from_serialized(to_buffer(result), utype));
},
[&] (const abstract_type& type) -> shared_ptr<terminal> {
if (type.is_collection()) {

View File

@@ -81,7 +81,7 @@ lists::literal::prepare(database& db, const sstring& keyspace, lw_shared_ptr<col
if (all_terminal) {
return value.bind(query_options::DEFAULT);
} else {
return make_shared(std::move(value));
return make_shared<delayed_value>(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<lists::value>(value::from_serialized(v, ltype, options.get_cql_serialization_format()));
});
} catch (marshal_exception& e) {
throw exceptions::invalid_request_exception(e.what());

View File

@@ -92,7 +92,7 @@ maps::literal::prepare(database& db, const sstring& keyspace, lw_shared_ptr<colu
if (all_terminal) {
return value.bind(query_options::DEFAULT);
} else {
return make_shared(std::move(value));
return make_shared<delayed_value>(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<const map_type_impl&>(*_receiver->type), options.get_cql_serialization_format()));
return ::make_shared<maps::value>(maps::value::from_serialized(*val, static_cast<const map_type_impl&>(*_receiver->type), options.get_cql_serialization_format()));
}
void

View File

@@ -64,6 +64,8 @@ private:
std::vector<shared_ptr<term::multi_column_raw>> _in_values;
shared_ptr<tuples::in_raw> _in_marker;
public:
multi_column_relation(std::vector<shared_ptr<column_identifier::raw>> entities,
const operator_type& relation_type, shared_ptr<term::multi_column_raw> values_or_marker,
std::vector<shared_ptr<term::multi_column_raw>> in_values, shared_ptr<tuples::in_raw> in_marker)
@@ -73,7 +75,15 @@ private:
, _in_values(std::move(in_values))
, _in_marker(std::move(in_marker))
{ }
public:
static shared_ptr<multi_column_relation> create_multi_column_relation(
std::vector<shared_ptr<column_identifier::raw>> entities, const operator_type& relation_type,
shared_ptr<term::multi_column_raw> values_or_marker, std::vector<shared_ptr<term::multi_column_raw>> in_values,
shared_ptr<tuples::in_raw> 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));
}
/**
* Creates a multi-column EQ, LT, LTE, GT, or GTE relation.
* For example: "SELECT ... WHERE (a, b) > (0, 1)"
@@ -85,7 +95,7 @@ public:
static shared_ptr<multi_column_relation> create_non_in_relation(std::vector<shared_ptr<column_identifier::raw>> entities,
const operator_type& relation_type, shared_ptr<term::multi_column_raw> values_or_marker) {
assert(relation_type != operator_type::IN);
return make_shared(multi_column_relation(std::move(entities), relation_type, std::move(values_or_marker), {}, {}));
return create_multi_column_relation(std::move(entities), relation_type, std::move(values_or_marker), {}, {});
}
/**
@@ -99,14 +109,14 @@ public:
std::vector<shared_ptr<tuples::literal>> in_values) {
std::vector<shared_ptr<term::multi_column_raw>> values(in_values.size());
std::copy(in_values.begin(), in_values.end(), values.begin());
return make_shared(multi_column_relation(std::move(entities), operator_type::IN, {}, std::move(values), {}));
return create_multi_column_relation(std::move(entities), operator_type::IN, {}, std::move(values), {});
}
static shared_ptr<multi_column_relation> create_in_relation(std::vector<shared_ptr<column_identifier::raw>> entities,
std::vector<shared_ptr<tuples::raw>> in_values) {
std::vector<shared_ptr<term::multi_column_raw>> values(in_values.size());
std::copy(in_values.begin(), in_values.end(), values.begin());
return make_shared(multi_column_relation(std::move(entities), operator_type::IN, {}, std::move(values), {}));
return create_multi_column_relation(std::move(entities), operator_type::IN, {}, std::move(values), {});
}
/**
@@ -118,7 +128,7 @@ public:
*/
static shared_ptr<multi_column_relation> create_single_marker_in_relation(std::vector<shared_ptr<column_identifier::raw>> entities,
shared_ptr<tuples::in_raw> in_marker) {
return make_shared(multi_column_relation(std::move(entities), operator_type::IN, {}, {}, std::move(in_marker)));
return create_multi_column_relation(std::move(entities), operator_type::IN, {}, {}, std::move(in_marker));
}
const std::vector<shared_ptr<column_identifier::raw>>& get_entities() const {
@@ -197,7 +207,7 @@ protected:
auto new_entities = boost::copy_range<decltype(_entities)>(_entities | boost::adaptors::transformed([&] (auto&& entity) {
return *entity == from ? ::make_shared<column_identifier::raw>(to) : entity;
}));
return ::make_shared(multi_column_relation(std::move(new_entities), _relation_type, _values_or_marker, _in_values, _in_marker));
return create_multi_column_relation(std::move(new_entities), _relation_type, _values_or_marker, _in_values, _in_marker);
}
virtual shared_ptr<term> to_term(const std::vector<lw_shared_ptr<column_specification>>& receivers,

View File

@@ -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<cql3::sets::value>(value::from_serialized(*value, type, options.get_cql_serialization_format()));
}
}

View File

@@ -66,7 +66,7 @@ private:
::shared_ptr<term::raw> _map_key;
::shared_ptr<term::raw> _value;
std::vector<::shared_ptr<term::raw>> _in_values;
private:
public:
single_column_relation(::shared_ptr<column_identifier::raw> entity, ::shared_ptr<term::raw> map_key,
const operator_type& type, ::shared_ptr<term::raw> value, std::vector<::shared_ptr<term::raw>> 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<single_column_relation> create_in_relation(::shared_ptr<column_identifier::raw> entity,
std::vector<::shared_ptr<term::raw>> in_values) {
return ::make_shared(single_column_relation(std::move(entity), {}, operator_type::IN, {}, std::move(in_values)));
return ::make_shared<single_column_relation>(std::move(entity), nullptr, operator_type::IN, nullptr, std::move(in_values));
}
::shared_ptr<column_identifier::raw> get_entity() {
@@ -190,8 +190,8 @@ protected:
virtual ::shared_ptr<relation> maybe_rename_identifier(const column_identifier::raw& from, column_identifier::raw to) override {
return *_entity == from
? ::make_shared(single_column_relation(
::make_shared<column_identifier::raw>(std::move(to)), _map_key, _relation_type, _value, _in_values))
? ::make_shared<single_column_relation>(
::make_shared<column_identifier::raw>(std::move(to)), _map_key, _relation_type, _value, _in_values)
: static_pointer_cast<single_column_relation>(shared_from_this());
}

View File

@@ -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<prepared_statement>(make_shared(std::move(batch_statement_)),
return std::make_unique<prepared_statement>(make_shared<cql3::statements::batch_statement>(std::move(batch_statement_)),
bound_names.get_specifications(),
std::move(partition_key_bind_indices));
}

View File

@@ -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<constants::value>(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>(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>(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>(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>(user_types::value::from_serialized(fragmented_temporary_buffer::view(*value), utype)));
},
[&] (const abstract_type& type) {
if (type.is_collection()) {

View File

@@ -51,7 +51,7 @@ tuples::literal::prepare(database& db, const sstring& keyspace, lw_shared_ptr<co
if (all_terminal) {
return value.bind(query_options::DEFAULT);
} else {
return make_shared(std::move(value));
return make_shared<delayed_value>(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<delayed_value>(std::move(value));
}
}
@@ -153,7 +153,7 @@ shared_ptr<terminal> 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>(tuples::in_value::from_serialized(*value, type, options));
}
}

View File

@@ -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<tuples::value>(value::from_serialized(*value, type));
}
}
};

View File

@@ -105,7 +105,7 @@ shared_ptr<term> 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<delayed_value>(std::move(value));
}
}
@@ -238,7 +238,7 @@ shared_ptr<terminal> 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<const user_type_impl&>(*_receiver->type)));
return make_shared<user_types::value>(value::from_serialized(*value, static_cast<const user_type_impl&>(*_receiver->type)));
}
void user_types::setter::execute(mutation& m, const clustering_key_prefix& row_key, const update_parameters& params) {

View File

@@ -1888,7 +1888,8 @@ static sstring get_snapshot_table_dir_prefix(const sstring& table_name) {
// (as we have been doing for a lot of the other operations, like the snapshot itself).
future<> database::clear_snapshot(sstring tag, std::vector<sstring> keyspace_names, const sstring& table_name) {
std::vector<sstring> data_dirs = _cfg.data_file_directories();
lw_shared_ptr<lister::dir_entry_types> dirs_only_entries_ptr = make_lw_shared<lister::dir_entry_types>({ directory_entry_type::directory });
auto dirs_only_entries_ptr =
make_lw_shared<lister::dir_entry_types>(lister::dir_entry_types{directory_entry_type::directory});
lw_shared_ptr<sstring> tag_ptr = make_lw_shared<sstring>(std::move(tag));
std::unordered_set<sstring> ks_names_set(keyspace_names.begin(), keyspace_names.end());

View File

@@ -237,7 +237,7 @@ static constexpr auto schema_gc_grace = std::chrono::duration_cast<std::chrono::
schema_ptr keyspaces() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, KEYSPACES), NAME, KEYSPACES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, KEYSPACES), NAME, KEYSPACES,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -253,7 +253,7 @@ schema_ptr keyspaces() {
utf8_type,
// comment
"keyspace definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -263,7 +263,7 @@ schema_ptr keyspaces() {
schema_ptr tables() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, TABLES), NAME, TABLES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, TABLES), NAME, TABLES,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -294,7 +294,7 @@ schema_ptr tables() {
utf8_type,
// comment
"table definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -344,7 +344,7 @@ schema_ptr scylla_tables(schema_features features) {
// VIEW" would list them - while it should only list real, selected, columns.
static schema_ptr columns_schema(const char* columns_table_name) {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, columns_table_name), NAME, columns_table_name,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, columns_table_name), NAME, columns_table_name,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -363,7 +363,7 @@ static schema_ptr columns_schema(const char* columns_table_name) {
utf8_type,
// comment
"column definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -385,7 +385,7 @@ schema_ptr view_virtual_columns() {
// is defined in column_computation.hh and system_schema docs.
//
static schema_ptr computed_columns_schema(const char* columns_table_name) {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, columns_table_name), NAME, columns_table_name,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, columns_table_name), NAME, columns_table_name,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -398,7 +398,7 @@ static schema_ptr computed_columns_schema(const char* columns_table_name) {
utf8_type,
// comment
"computed columns"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -411,7 +411,7 @@ schema_ptr computed_columns() {
schema_ptr dropped_columns() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, DROPPED_COLUMNS), NAME, DROPPED_COLUMNS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, DROPPED_COLUMNS), NAME, DROPPED_COLUMNS,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -427,7 +427,7 @@ schema_ptr dropped_columns() {
utf8_type,
// comment
"dropped column registry"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -437,7 +437,7 @@ schema_ptr dropped_columns() {
schema_ptr triggers() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, TRIGGERS), NAME, TRIGGERS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, TRIGGERS), NAME, TRIGGERS,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -452,7 +452,7 @@ schema_ptr triggers() {
utf8_type,
// comment
"trigger definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -462,7 +462,7 @@ schema_ptr triggers() {
schema_ptr views() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, VIEWS), NAME, VIEWS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, VIEWS), NAME, VIEWS,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -496,7 +496,7 @@ schema_ptr views() {
utf8_type,
// comment
"view definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -506,7 +506,7 @@ schema_ptr views() {
schema_ptr indexes() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, INDEXES), NAME, INDEXES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, INDEXES), NAME, INDEXES,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -522,7 +522,7 @@ schema_ptr indexes() {
utf8_type,
// comment
"secondary index definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -532,7 +532,7 @@ schema_ptr indexes() {
schema_ptr types() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, TYPES), NAME, TYPES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, TYPES), NAME, TYPES,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -548,7 +548,7 @@ schema_ptr types() {
utf8_type,
// comment
"user defined type definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -558,7 +558,7 @@ schema_ptr types() {
schema_ptr functions() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, FUNCTIONS), NAME, FUNCTIONS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, FUNCTIONS), NAME, FUNCTIONS,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -577,7 +577,7 @@ schema_ptr functions() {
utf8_type,
// comment
"user defined function definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -587,7 +587,7 @@ schema_ptr functions() {
schema_ptr aggregates() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, AGGREGATES), NAME, AGGREGATES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, AGGREGATES), NAME, AGGREGATES,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -606,7 +606,7 @@ schema_ptr aggregates() {
utf8_type,
// comment
"user defined aggregate definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();

View File

@@ -129,7 +129,7 @@ table_schema_version generate_schema_version(utils::UUID table_id, uint16_t offs
schema_ptr hints() {
static thread_local auto hints = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, HINTS), NAME, HINTS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, HINTS), NAME, HINTS,
// partition key
{{"target_id", uuid_type}},
// clustering key
@@ -142,7 +142,7 @@ schema_ptr hints() {
utf8_type,
// comment
"hints awaiting delivery"
)));
));
builder.set_gc_grace_seconds(0);
builder.set_compaction_strategy_options({{ "enabled", "false" }});
builder.with_version(generate_schema_version(builder.uuid()));
@@ -153,7 +153,7 @@ schema_ptr hints() {
schema_ptr batchlog() {
static thread_local auto batchlog = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, BATCHLOG), NAME, BATCHLOG,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, BATCHLOG), NAME, BATCHLOG,
// partition key
{{"id", uuid_type}},
// clustering key
@@ -169,7 +169,7 @@ schema_ptr batchlog() {
// FIXME: the original Java code also had:
// operations on resulting CFMetaData:
// .compactionStrategyOptions(Collections.singletonMap("min_threshold", "2"))
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
@@ -180,7 +180,7 @@ schema_ptr batchlog() {
/*static*/ schema_ptr paxos() {
static thread_local auto paxos = [] {
// FIXME: switch to the new schema_builder interface (with_column(...), etc)
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, PAXOS), NAME, PAXOS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, PAXOS), NAME, PAXOS,
// partition key
{{"row_key", bytes_type}}, // byte representation of a row key that hashes to the same token as original
// clustering key
@@ -202,7 +202,7 @@ schema_ptr batchlog() {
// FIXME: the original Java code also had:
// operations on resulting CFMetaData:
// .compactionStrategyClass(LeveledCompactionStrategy.class);
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
builder.set_wait_for_sync_to_commitlog(true);
@@ -213,7 +213,7 @@ schema_ptr batchlog() {
schema_ptr built_indexes() {
static thread_local auto built_indexes = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, BUILT_INDEXES), NAME, BUILT_INDEXES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, BUILT_INDEXES), NAME, BUILT_INDEXES,
// partition key
{{"table_name", utf8_type}}, // table_name here is the name of the keyspace - don't be fooled
// clustering key
@@ -226,7 +226,7 @@ schema_ptr built_indexes() {
utf8_type,
// comment
"built column indexes"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::yes);
@@ -236,7 +236,7 @@ schema_ptr built_indexes() {
/*static*/ schema_ptr local() {
static thread_local auto local = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, LOCAL), NAME, LOCAL,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, LOCAL), NAME, LOCAL,
// partition key
{{"key", utf8_type}},
// clustering key
@@ -273,7 +273,7 @@ schema_ptr built_indexes() {
utf8_type,
// comment
"information about the local node"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
builder.remove_column("scylla_cpu_sharding_algorithm");
@@ -286,7 +286,7 @@ schema_ptr built_indexes() {
/*static*/ schema_ptr peers() {
static thread_local auto peers = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, PEERS), NAME, PEERS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, PEERS), NAME, PEERS,
// partition key
{{"peer", inet_addr_type}},
// clustering key
@@ -309,7 +309,7 @@ schema_ptr built_indexes() {
utf8_type,
// comment
"information about known peers in the cluster"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
@@ -319,7 +319,7 @@ schema_ptr built_indexes() {
/*static*/ schema_ptr peer_events() {
static thread_local auto peer_events = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, PEER_EVENTS), NAME, PEER_EVENTS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, PEER_EVENTS), NAME, PEER_EVENTS,
// partition key
{{"peer", inet_addr_type}},
// clustering key
@@ -334,7 +334,7 @@ schema_ptr built_indexes() {
utf8_type,
// comment
"events related to peers"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
@@ -344,7 +344,7 @@ schema_ptr built_indexes() {
/*static*/ schema_ptr range_xfers() {
static thread_local auto range_xfers = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, RANGE_XFERS), NAME, RANGE_XFERS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, RANGE_XFERS), NAME, RANGE_XFERS,
// partition key
{{"token_bytes", bytes_type}},
// clustering key
@@ -357,7 +357,7 @@ schema_ptr built_indexes() {
utf8_type,
// comment
"ranges requested for transfer"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
@@ -367,7 +367,7 @@ schema_ptr built_indexes() {
/*static*/ schema_ptr compactions_in_progress() {
static thread_local auto compactions_in_progress = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, COMPACTIONS_IN_PROGRESS), NAME, COMPACTIONS_IN_PROGRESS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, COMPACTIONS_IN_PROGRESS), NAME, COMPACTIONS_IN_PROGRESS,
// partition key
{{"id", uuid_type}},
// clustering key
@@ -384,7 +384,7 @@ schema_ptr built_indexes() {
utf8_type,
// comment
"unfinished compactions"
)));
));
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
}();
@@ -393,7 +393,7 @@ schema_ptr built_indexes() {
/*static*/ schema_ptr compaction_history() {
static thread_local auto compaction_history = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, COMPACTION_HISTORY), NAME, COMPACTION_HISTORY,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, COMPACTION_HISTORY), NAME, COMPACTION_HISTORY,
// partition key
{{"id", uuid_type}},
// clustering key
@@ -413,7 +413,7 @@ schema_ptr built_indexes() {
utf8_type,
// comment
"week-long compaction history"
)));
));
builder.set_default_time_to_live(std::chrono::duration_cast<std::chrono::seconds>(days(7)));
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
@@ -423,7 +423,7 @@ schema_ptr built_indexes() {
/*static*/ schema_ptr sstable_activity() {
static thread_local auto sstable_activity = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, SSTABLE_ACTIVITY), NAME, SSTABLE_ACTIVITY,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, SSTABLE_ACTIVITY), NAME, SSTABLE_ACTIVITY,
// partition key
{
{"keyspace_name", utf8_type},
@@ -443,7 +443,7 @@ schema_ptr built_indexes() {
utf8_type,
// comment
"historic sstable read rates"
)));
));
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
}();
@@ -452,7 +452,7 @@ schema_ptr built_indexes() {
schema_ptr size_estimates() {
static thread_local auto size_estimates = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, SIZE_ESTIMATES), NAME, SIZE_ESTIMATES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, SIZE_ESTIMATES), NAME, SIZE_ESTIMATES,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -468,7 +468,7 @@ schema_ptr size_estimates() {
utf8_type,
// comment
"per-table primary range size estimates"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
@@ -478,7 +478,7 @@ schema_ptr size_estimates() {
/*static*/ schema_ptr large_partitions() {
static thread_local auto large_partitions = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, LARGE_PARTITIONS), NAME, LARGE_PARTITIONS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, LARGE_PARTITIONS), NAME, LARGE_PARTITIONS,
// partition key
{{"keyspace_name", utf8_type}, {"table_name", utf8_type}},
// clustering key
@@ -495,7 +495,7 @@ schema_ptr size_estimates() {
utf8_type,
// comment
"partitions larger than specified threshold"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
@@ -546,7 +546,7 @@ static schema_ptr large_cells() {
/*static*/ schema_ptr scylla_local() {
static thread_local auto scylla_local = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, SCYLLA_LOCAL), NAME, SCYLLA_LOCAL,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, SCYLLA_LOCAL), NAME, SCYLLA_LOCAL,
// partition key
{{"key", utf8_type}},
// clustering key
@@ -561,7 +561,7 @@ static schema_ptr large_cells() {
utf8_type,
// comment
"Scylla specific information about the local node"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
@@ -573,7 +573,7 @@ static schema_ptr large_cells() {
* but without `request_count'. Also CK is different: C* has only (`port'). */
static schema_ptr clients() {
thread_local auto clients = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, CLIENTS), NAME, CLIENTS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, CLIENTS), NAME, CLIENTS,
// partition key
{{"address", inet_addr_type}},
// clustering key
@@ -597,7 +597,7 @@ static schema_ptr clients() {
utf8_type,
// comment
"list of connected clients"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
@@ -611,7 +611,7 @@ namespace v3 {
schema_ptr batches() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, BATCHES), NAME, BATCHES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, BATCHES), NAME, BATCHES,
// partition key
{{"id", timeuuid_type}},
// clustering key
@@ -624,7 +624,7 @@ schema_ptr batches() {
utf8_type,
// comment
"batches awaiting replay"
)));
));
builder.set_gc_grace_seconds(0);
// FIXME: the original Java code also had:
//.copy(new LocalPartitioner(TimeUUIDType.instance))
@@ -644,7 +644,7 @@ schema_ptr built_indexes() {
schema_ptr local() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, LOCAL), NAME, LOCAL,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, LOCAL), NAME, LOCAL,
// partition key
{{"key", utf8_type}},
// clustering key
@@ -675,7 +675,7 @@ schema_ptr local() {
utf8_type,
// comment
"information about the local node"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
@@ -685,7 +685,7 @@ schema_ptr local() {
schema_ptr truncated() {
static thread_local auto local = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, TRUNCATED), NAME, TRUNCATED,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, TRUNCATED), NAME, TRUNCATED,
// partition key
{{"table_uuid", uuid_type}},
// clustering key
@@ -703,7 +703,7 @@ schema_ptr truncated() {
utf8_type,
// comment
"information about table truncation"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
@@ -753,7 +753,7 @@ schema_ptr scylla_local() {
schema_ptr available_ranges() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, AVAILABLE_RANGES), NAME, AVAILABLE_RANGES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, AVAILABLE_RANGES), NAME, AVAILABLE_RANGES,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -766,7 +766,7 @@ schema_ptr available_ranges() {
utf8_type,
// comment
"available keyspace/ranges during bootstrap/replace that are ready to be served"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -776,7 +776,7 @@ schema_ptr available_ranges() {
schema_ptr views_builds_in_progress() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, VIEWS_BUILDS_IN_PROGRESS), NAME, VIEWS_BUILDS_IN_PROGRESS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, VIEWS_BUILDS_IN_PROGRESS), NAME, VIEWS_BUILDS_IN_PROGRESS,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -789,7 +789,7 @@ schema_ptr views_builds_in_progress() {
utf8_type,
// comment
"views builds current progress"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -799,7 +799,7 @@ schema_ptr views_builds_in_progress() {
schema_ptr built_views() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, BUILT_VIEWS), NAME, BUILT_VIEWS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, BUILT_VIEWS), NAME, BUILT_VIEWS,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -812,7 +812,7 @@ schema_ptr built_views() {
utf8_type,
// comment
"built views"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build();
@@ -838,7 +838,7 @@ schema_ptr scylla_views_builds_in_progress() {
/*static*/ schema_ptr cdc_local() {
static thread_local auto cdc_local = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(NAME, CDC_LOCAL), NAME, CDC_LOCAL,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, CDC_LOCAL), NAME, CDC_LOCAL,
// partition key
{{"key", utf8_type}},
// clustering key
@@ -856,7 +856,7 @@ schema_ptr scylla_views_builds_in_progress() {
utf8_type,
// comment
"CDC-specific information that the local node stores"
)));
));
builder.set_gc_grace_seconds(0);
builder.with_version(generate_schema_version(builder.uuid()));
return builder.build(schema_builder::compact_storage::no);
@@ -870,7 +870,7 @@ namespace legacy {
schema_ptr hints() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, HINTS), NAME, HINTS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, HINTS), NAME, HINTS,
// partition key
{{"target_id", uuid_type}},
// clustering key
@@ -883,7 +883,7 @@ schema_ptr hints() {
utf8_type,
// comment
"*DEPRECATED* hints awaiting delivery"
)));
));
builder.set_gc_grace_seconds(0);
builder.set_compaction_strategy(sstables::compaction_strategy_type::size_tiered);
builder.set_compaction_strategy_options({{"enabled", "false"}});
@@ -896,7 +896,7 @@ schema_ptr hints() {
schema_ptr batchlog() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, BATCHLOG), NAME, BATCHLOG,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, BATCHLOG), NAME, BATCHLOG,
// partition key
{{"id", uuid_type}},
// clustering key
@@ -909,7 +909,7 @@ schema_ptr batchlog() {
utf8_type,
// comment
"*DEPRECATED* batchlog entries"
)));
));
builder.set_gc_grace_seconds(0);
builder.set_compaction_strategy(sstables::compaction_strategy_type::size_tiered);
builder.set_compaction_strategy_options({{"min_threshold", "2"}});
@@ -924,7 +924,7 @@ static constexpr auto schema_gc_grace = std::chrono::duration_cast<std::chrono::
schema_ptr keyspaces() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, KEYSPACES), NAME, KEYSPACES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, KEYSPACES), NAME, KEYSPACES,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -941,7 +941,7 @@ schema_ptr keyspaces() {
utf8_type,
// comment
"*DEPRECATED* keyspace definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with(schema_builder::compact_storage::yes);
builder.with_version(generate_schema_version(builder.uuid()));
@@ -952,7 +952,7 @@ schema_ptr keyspaces() {
schema_ptr column_families() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, COLUMNFAMILIES), NAME, COLUMNFAMILIES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, COLUMNFAMILIES), NAME, COLUMNFAMILIES,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -994,7 +994,7 @@ schema_ptr column_families() {
utf8_type,
// comment
"*DEPRECATED* table definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with(schema_builder::compact_storage::no);
builder.with_version(generate_schema_version(builder.uuid()));
@@ -1005,7 +1005,7 @@ schema_ptr column_families() {
schema_ptr columns() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, COLUMNS), NAME, COLUMNS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, COLUMNS), NAME, COLUMNS,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -1025,7 +1025,7 @@ schema_ptr columns() {
utf8_type,
// comment
"column definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with(schema_builder::compact_storage::no);
builder.with_version(generate_schema_version(builder.uuid()));
@@ -1036,7 +1036,7 @@ schema_ptr columns() {
schema_ptr triggers() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, TRIGGERS), NAME, TRIGGERS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, TRIGGERS), NAME, TRIGGERS,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -1051,7 +1051,7 @@ schema_ptr triggers() {
utf8_type,
// comment
"trigger definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with(schema_builder::compact_storage::no);
builder.with_version(generate_schema_version(builder.uuid()));
@@ -1062,7 +1062,7 @@ schema_ptr triggers() {
schema_ptr usertypes() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, USERTYPES), NAME, USERTYPES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, USERTYPES), NAME, USERTYPES,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -1078,7 +1078,7 @@ schema_ptr usertypes() {
utf8_type,
// comment
"user defined type definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with(schema_builder::compact_storage::no);
builder.with_version(generate_schema_version(builder.uuid()));
@@ -1095,7 +1095,7 @@ schema_ptr functions() {
* installations of that to migrate, rather than our own (if we dont use the table).
*/
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, FUNCTIONS), NAME, FUNCTIONS,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, FUNCTIONS), NAME, FUNCTIONS,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -1115,7 +1115,7 @@ schema_ptr functions() {
utf8_type,
// comment
"*DEPRECATED* user defined type definitions"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with(schema_builder::compact_storage::no);
builder.with_version(generate_schema_version(builder.uuid()));
@@ -1126,7 +1126,7 @@ schema_ptr functions() {
schema_ptr aggregates() {
static thread_local auto schema = [] {
schema_builder builder(make_lw_shared(::schema(generate_legacy_id(NAME, AGGREGATES), NAME, AGGREGATES,
schema_builder builder(make_shared_schema(generate_legacy_id(NAME, AGGREGATES), NAME, AGGREGATES,
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -1146,7 +1146,7 @@ schema_ptr aggregates() {
utf8_type,
// comment
"*DEPRECATED* user defined aggregate definition"
)));
));
builder.set_gc_grace_seconds(schema_gc_grace);
builder.with(schema_builder::compact_storage::no);
builder.with_version(generate_schema_version(builder.uuid()));
@@ -1997,7 +1997,7 @@ query(distributed<service::storage_proxy>& proxy, const sstring& ks_name, const
auto cmd = make_lw_shared<query::read_command>(schema->id(), schema->version(), std::move(slice), proxy.local().get_max_result_size(slice));
return proxy.local().query(schema, cmd, {query::full_partition_range}, db::consistency_level::ONE,
{db::no_timeout, empty_service_permit(), service::client_state::for_internal_calls(), nullptr}).then([schema, cmd] (auto&& qr) {
return make_lw_shared(query::result_set::from_raw_result(schema, cmd->slice, *qr.query_result));
return make_lw_shared<query::result_set>(query::result_set::from_raw_result(schema, cmd->slice, *qr.query_result));
});
}
@@ -2013,7 +2013,7 @@ query(distributed<service::storage_proxy>& proxy, const sstring& ks_name, const
return proxy.local().query(schema, cmd, {dht::partition_range::make_singular(key)}, db::consistency_level::ONE,
{db::no_timeout, empty_service_permit(), service::client_state::for_internal_calls(), nullptr}).then([schema, cmd] (auto&& qr) {
return make_lw_shared(query::result_set::from_raw_result(schema, cmd->slice, *qr.query_result));
return make_lw_shared<query::result_set>(query::result_set::from_raw_result(schema, cmd->slice, *qr.query_result));
});
}

View File

@@ -1289,7 +1289,7 @@ void view_builder::initialize_reader_at_current_token(build_step& step) {
step.reader = make_local_shard_sstable_reader(
step.base->schema(),
std::move(permit),
make_lw_shared(sstables::sstable_set(step.base->get_sstable_set())),
make_lw_shared<sstables::sstable_set>(step.base->get_sstable_set()),
step.prange,
step.pslice,
default_priority_class(),

View File

@@ -59,7 +59,7 @@ future<> view_update_generator::start() {
// Exploit the fact that sstables in the staging directory
// are usually non-overlapping and use a partitioned set for
// the read.
auto ssts = make_lw_shared(sstables::make_partitioned_sstable_set(s, make_lw_shared<sstable_list>(sstable_list{}), false));
auto ssts = make_lw_shared<sstables::sstable_set>(sstables::make_partitioned_sstable_set(s, make_lw_shared<sstable_list>(sstable_list{}), false));
for (auto& sst : sstables) {
ssts->insert(sst);
}

17
main.cc
View File

@@ -401,7 +401,7 @@ public:
};
template <typename Func>
inline auto defer_verbose_shutdown(const char* what, Func&& func) {
static auto defer_verbose_shutdown(const char* what, Func&& func) {
auto vfunc = [what, func = std::forward<Func>(func)] () mutable {
startlog.info("Shutting down {}", what);
try {
@@ -413,7 +413,8 @@ inline auto defer_verbose_shutdown(const char* what, Func&& func) {
startlog.info("Shutting down {} was successful", what);
};
return deferred_action(std::move(vfunc));
auto ret = deferred_action(std::move(vfunc));
return ::make_shared<decltype(ret)>(std::move(ret));
}
int main(int ac, char** av) {
@@ -594,9 +595,9 @@ int main(int ac, char** av) {
std::any stop_prometheus;
if (pport) {
prometheus_server.start("prometheus").get();
stop_prometheus = ::make_shared(defer_verbose_shutdown("prometheus API server", [&prometheus_server, pport] {
stop_prometheus = defer_verbose_shutdown("prometheus API server", [&prometheus_server, pport] {
prometheus_server.stop().get();
}));
});
//FIXME discarded future
prometheus::config pctx;
@@ -1155,9 +1156,9 @@ int main(int ac, char** av) {
}).get();
// FIXME -- this should be done via client hooks instead
stop_cql = ::make_shared(defer_verbose_shutdown("native transport", [&cql_server_ctl] {
stop_cql = defer_verbose_shutdown("native transport", [&cql_server_ctl] {
cql_server_ctl.stop().get();
}));
});
}
api::set_transport_controller(ctx, cql_server_ctl).get();
@@ -1178,9 +1179,9 @@ int main(int ac, char** av) {
}).get();
// FIXME -- this should be done via client hooks instead
stop_rpc = ::make_shared(defer_verbose_shutdown("rpc server", [&thrift_ctl] {
stop_rpc = defer_verbose_shutdown("rpc server", [&thrift_ctl] {
thrift_ctl.stop().get();
}));
});
}
api::set_rpc_controller(ctx, thrift_ctl).get();

View File

@@ -126,7 +126,7 @@ void write(serializer s, Output& out, const lw_shared_ptr<T>& v) {
}
template <typename Input, typename T>
lw_shared_ptr<T> read(serializer s, Input& in, boost::type<lw_shared_ptr<T>>) {
return make_lw_shared(read(s, in, boost::type<T>()));
return make_lw_shared<T>(read(s, in, boost::type<T>()));
}
static logging::logger mlogger("messaging_service");

View File

@@ -186,8 +186,8 @@ private:
friend class optimized_optional<mutation_source>;
public:
mutation_source(flat_reader_factory_type fn, std::function<partition_presence_checker()> pcf = [] { return make_default_partition_presence_checker(); })
: _fn(make_lw_shared(std::move(fn)))
, _presence_checker_factory(make_lw_shared(std::move(pcf)))
: _fn(make_lw_shared<flat_reader_factory_type>(std::move(fn)))
, _presence_checker_factory(make_lw_shared<std::function<partition_presence_checker()>>(std::move(pcf)))
{ }
// For sources which don't care about the mutation_reader::forwarding flag (always fast forwardable)

View File

@@ -44,7 +44,7 @@ namespace redis {
static logging::logger logger("keyspace_utils");
schema_ptr strings_schema(sstring ks_name) {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(ks_name, redis::STRINGs), ks_name, redis::STRINGs,
schema_builder builder(make_shared_schema(generate_legacy_id(ks_name, redis::STRINGs), ks_name, redis::STRINGs,
// partition key
{{"pkey", utf8_type}},
// clustering key
@@ -57,7 +57,7 @@ schema_ptr strings_schema(sstring ks_name) {
utf8_type,
// comment
"save STRINGs for redis"
)));
));
builder.set_gc_grace_seconds(0);
builder.with(schema_builder::compact_storage::yes);
builder.with_version(db::system_keyspace::generate_schema_version(builder.uuid()));
@@ -65,7 +65,7 @@ schema_ptr strings_schema(sstring ks_name) {
}
schema_ptr lists_schema(sstring ks_name) {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(ks_name, redis::LISTs), ks_name, redis::LISTs,
schema_builder builder(make_shared_schema(generate_legacy_id(ks_name, redis::LISTs), ks_name, redis::LISTs,
// partition key
{{"pkey", utf8_type}},
// clustering key
@@ -78,7 +78,7 @@ schema_ptr lists_schema(sstring ks_name) {
utf8_type,
// comment
"save LISTs for redis"
)));
));
builder.set_gc_grace_seconds(0);
builder.with(schema_builder::compact_storage::yes);
builder.with_version(db::system_keyspace::generate_schema_version(builder.uuid()));
@@ -86,7 +86,7 @@ schema_ptr lists_schema(sstring ks_name) {
}
schema_ptr hashes_schema(sstring ks_name) {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(ks_name, redis::HASHes), ks_name, redis::HASHes,
schema_builder builder(make_shared_schema(generate_legacy_id(ks_name, redis::HASHes), ks_name, redis::HASHes,
// partition key
{{"pkey", utf8_type}},
// clustering key
@@ -99,7 +99,7 @@ schema_ptr hashes_schema(sstring ks_name) {
utf8_type,
// comment
"save HASHes for redis"
)));
));
builder.set_gc_grace_seconds(0);
builder.with(schema_builder::compact_storage::yes);
builder.with_version(db::system_keyspace::generate_schema_version(builder.uuid()));
@@ -107,7 +107,7 @@ schema_ptr hashes_schema(sstring ks_name) {
}
schema_ptr sets_schema(sstring ks_name) {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(ks_name, redis::SETs), ks_name, redis::SETs,
schema_builder builder(make_shared_schema(generate_legacy_id(ks_name, redis::SETs), ks_name, redis::SETs,
// partition key
{{"pkey", utf8_type}},
// clustering key
@@ -120,7 +120,7 @@ schema_ptr sets_schema(sstring ks_name) {
utf8_type,
// comment
"save SETs for redis"
)));
));
builder.set_gc_grace_seconds(0);
builder.with(schema_builder::compact_storage::yes);
builder.with_version(db::system_keyspace::generate_schema_version(builder.uuid()));
@@ -128,7 +128,7 @@ schema_ptr sets_schema(sstring ks_name) {
}
schema_ptr zsets_schema(sstring ks_name) {
schema_builder builder(make_lw_shared(schema(generate_legacy_id(ks_name, redis::ZSETs), ks_name, redis::ZSETs,
schema_builder builder(make_shared_schema(generate_legacy_id(ks_name, redis::ZSETs), ks_name, redis::ZSETs,
// partition key
{{"pkey", utf8_type}},
// clustering key
@@ -141,7 +141,7 @@ schema_ptr zsets_schema(sstring ks_name) {
utf8_type,
// comment
"save ZSETs for redis"
)));
));
builder.set_gc_grace_seconds(0);
builder.with(schema_builder::compact_storage::yes);
builder.with_version(db::system_keyspace::generate_schema_version(builder.uuid()));

View File

@@ -83,7 +83,7 @@ future<lw_shared_ptr<strings_result>> read_strings(service::storage_proxy& proxy
partition_ranges.emplace_back(std::move(partition_range));
auto read_consistency_level = options.get_read_consistency_level();
db::timeout_clock::time_point timeout = db::timeout_clock::now() + options.get_read_timeout();
return proxy.query(schema, make_lw_shared(std::move(cmd)), std::move(partition_ranges), read_consistency_level, {timeout, permit, service::client_state::for_internal_calls()}).then([ps, schema] (auto qr) {
return proxy.query(schema, make_lw_shared<query::read_command>(std::move(cmd)), std::move(partition_ranges), read_consistency_level, {timeout, permit, service::client_state::for_internal_calls()}).then([ps, schema] (auto qr) {
return query::result_view::do_with(*qr.query_result, [&] (query::result_view v) {
auto pd = make_lw_shared<strings_result>();
v.consume(ps, strings_result_builder(pd, schema, ps));

View File

@@ -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<query::partition_slice>(partition_slice_builder(*this).build());
}
const column_mapping& schema::get_column_mapping() const {
@@ -433,6 +433,15 @@ schema::schema(const schema& o)
}
}
lw_shared_ptr<schema> make_shared_schema(std::optional<utils::UUID> id, std::string_view ks_name,
std::string_view cf_name, std::vector<schema::column> partition_key, std::vector<schema::column> clustering_key,
std::vector<schema::column> regular_columns, std::vector<schema::column> static_columns,
data_type regular_column_name_type, std::string_view comment) {
return make_lw_shared<schema>(std::move(id), std::move(ks_name), std::move(cf_name), std::move(partition_key),
std::move(clustering_key), std::move(regular_columns), std::move(static_columns),
std::move(regular_column_name_type), std::move(comment));
}
schema::~schema() {
if (_registry_entry) {
_registry_entry->detach_schema();

View File

@@ -968,6 +968,10 @@ public:
}
};
lw_shared_ptr<schema> make_shared_schema(std::optional<utils::UUID> id, std::string_view ks_name, std::string_view cf_name,
std::vector<schema::column> partition_key, std::vector<schema::column> clustering_key, std::vector<schema::column> regular_columns,
std::vector<schema::column> static_columns, data_type regular_column_name_type, std::string_view comment = {});
bool operator==(const schema&, const schema&);
using schema_ptr = lw_shared_ptr<const schema>;

View File

@@ -28,9 +28,6 @@ namespace seastar {
template <typename T>
class shared_ptr;
template <typename T>
shared_ptr<T> make_shared(T&&);
template <typename T, typename... A>
shared_ptr<T> make_shared(A&&... a);

View File

@@ -3559,7 +3559,7 @@ protected:
if (rr_opt && (can_send_short_read || data_resolver->all_reached_end() || rr_opt->row_count() >= original_row_limit()
|| data_resolver->live_partition_count() >= original_partition_limit())
&& !data_resolver->any_partition_short_read()) {
auto result = ::make_foreign(::make_lw_shared(
auto result = ::make_foreign(::make_lw_shared<query::result>(
to_data_query_result(std::move(*rr_opt), _schema, _cmd->slice, _cmd->row_limit, cmd->partition_limit)));
// wait for write to complete before returning result to prevent multiple concurrent read requests to
// trigger repair multiple times and to prevent quorum read to return an old value, even after a quorum
@@ -3900,7 +3900,7 @@ storage_proxy::query_result_local(schema_ptr s, lw_shared_ptr<query::read_comman
return query_nonsingular_mutations_locally(s, cmd, {pr}, std::move(trace_state), timeout).then([s, cmd, opts] (rpc::tuple<foreign_ptr<lw_shared_ptr<reconcilable_result>>, cache_temperature>&& r_ht) {
auto&& [r, ht] = r_ht;
return make_ready_future<rpc::tuple<foreign_ptr<lw_shared_ptr<query::result>>, cache_temperature>>(
rpc::tuple(::make_foreign(::make_lw_shared(to_data_query_result(*r, s, cmd->slice, cmd->row_limit, cmd->partition_limit, opts))), ht));
rpc::tuple(::make_foreign(::make_lw_shared<query::result>(to_data_query_result(*r, s, cmd->slice, cmd->row_limit, cmd->partition_limit, opts))), ht));
});
}
}
@@ -5169,7 +5169,7 @@ storage_proxy::query_mutations_locally(schema_ptr s, lw_shared_ptr<query::read_c
return _db.invoke_on(shard, _read_smp_service_group, [cmd, &pr, gs=global_schema_ptr(s), timeout, gt = tracing::global_trace_state_ptr(std::move(trace_state))] (database& db) mutable {
return db.query_mutations(gs, *cmd, pr, gt, timeout).then([] (std::tuple<reconcilable_result, cache_temperature> result_ht) {
auto&& [result, ht] = result_ht;
return make_ready_future<rpc::tuple<foreign_ptr<lw_shared_ptr<reconcilable_result>>, cache_temperature>>(rpc::tuple(make_foreign(make_lw_shared(std::move(result))), ht));
return make_ready_future<rpc::tuple<foreign_ptr<lw_shared_ptr<reconcilable_result>>, cache_temperature>>(rpc::tuple(make_foreign(make_lw_shared<reconcilable_result>(std::move(result))), ht));
});
});
} else {

View File

@@ -26,7 +26,7 @@
class service_permit {
seastar::lw_shared_ptr<seastar::semaphore_units<>> _permit;
service_permit(seastar::semaphore_units<>&& u) : _permit(seastar::make_lw_shared(std::move(u))) {}
service_permit(seastar::semaphore_units<>&& u) : _permit(seastar::make_lw_shared<seastar::semaphore_units<>>(std::move(u))) {}
friend service_permit make_service_permit(seastar::semaphore_units<>&& permit);
friend service_permit empty_service_permit();
};

View File

@@ -100,7 +100,7 @@ public:
column_translation get_for_schema(
const schema& s, const serialization_header& header, const sstable_enabled_features& features) {
if (s.version() != _state->schema_uuid) {
_state = make_lw_shared(state(s, header, features));
_state = make_lw_shared<const state>(s, header, features);
}
return *this;
}

View File

@@ -123,7 +123,7 @@ sstable_set::sstable_set(std::unique_ptr<sstable_set_impl> impl, schema_ptr s, l
sstable_set::sstable_set(const sstable_set& x)
: _impl(x._impl->clone())
, _schema(x._schema)
, _all(make_lw_shared(sstable_list(*x._all)))
, _all(make_lw_shared<sstable_list>(*x._all))
, _all_runs(x._all_runs) {
}

View File

@@ -678,7 +678,7 @@ void table::add_sstable(sstables::shared_sstable sstable) {
on_internal_error(tlogger, format("Attempted to load the shared SSTable {} at table", sstable->get_filename()));
}
// allow in-progress reads to continue using old list
auto new_sstables = make_lw_shared(*_sstables);
auto new_sstables = make_lw_shared<sstables::sstable_set>(*_sstables);
new_sstables->insert(sstable);
_sstables = std::move(new_sstables);
update_stats_for_new_sstable(sstable->bytes_on_disk());
@@ -1035,7 +1035,7 @@ table::rebuild_sstable_list(const std::vector<sstables::shared_sstable>& new_sst
new_sstable_list.insert(tab);
}
}
_sstables = make_lw_shared(std::move(new_sstable_list));
_sstables = make_lw_shared<sstables::sstable_set>(std::move(new_sstable_list));
}
// Note: must run in a seastar thread
@@ -1227,7 +1227,7 @@ int64_t table::get_unleveled_sstables() const {
}
future<std::unordered_set<sstring>> table::get_sstables_by_partition_key(const sstring& key) const {
return do_with(std::unordered_set<sstring>(), lw_shared_ptr<sstables::sstable_set::incremental_selector>(make_lw_shared(get_sstable_set().make_incremental_selector())),
return do_with(std::unordered_set<sstring>(), make_lw_shared<sstables::sstable_set::incremental_selector>(get_sstable_set().make_incremental_selector()),
partition_key(partition_key::from_nodetool_style_string(_schema, key)),
[this] (std::unordered_set<sstring>& filenames, lw_shared_ptr<sstables::sstable_set::incremental_selector>& sel, partition_key& pk) {
return do_with(dht::decorated_key(dht::decorate_key(*_schema, pk)),
@@ -1279,7 +1279,7 @@ lw_shared_ptr<const sstable_list> table::get_sstables_including_compacted_undele
if (_sstables_compacted_but_not_deleted.empty()) {
return get_sstables();
}
auto ret = make_lw_shared(*_sstables->all());
auto ret = make_lw_shared<sstable_list>(*_sstables->all());
for (auto&& s : _sstables_compacted_but_not_deleted) {
ret->insert(s);
}
@@ -1315,7 +1315,7 @@ table::table(schema_ptr schema, config config, db::commitlog* cl, compaction_man
)
, _memtables(_config.enable_disk_writes ? make_memtable_list() : make_memory_only_memtable_list())
, _compaction_strategy(make_compaction_strategy(_schema->compaction_strategy(), _schema->compaction_strategy_options()))
, _sstables(make_lw_shared(_compaction_strategy.make_sstable_set(_schema)))
, _sstables(make_lw_shared<sstables::sstable_set>(_compaction_strategy.make_sstable_set(_schema)))
, _cache(_schema, sstables_as_snapshot_source(), row_cache_tracker, is_continuous::yes)
, _commitlog(cl)
, _compaction_manager(compaction_manager)
@@ -1331,7 +1331,7 @@ table::table(schema_ptr schema, config config, db::commitlog* cl, compaction_man
partition_presence_checker
table::make_partition_presence_checker(lw_shared_ptr<sstables::sstable_set> sstables) {
auto sel = make_lw_shared(sstables->make_incremental_selector());
auto sel = make_lw_shared<sstables::sstable_set::incremental_selector>(sstables->make_incremental_selector());
return [this, sstables = std::move(sstables), sel = std::move(sel)] (const dht::decorated_key& key) {
auto& sst = sel->select(key).sstables;
if (sst.empty()) {
@@ -1650,7 +1650,7 @@ future<db::replay_position> table::discard_sstables(db_clock::time_point truncat
void prune(db_clock::time_point truncated_at) {
auto gc_trunc = to_gc_clock(truncated_at);
auto pruned = make_lw_shared(cf._compaction_strategy.make_sstable_set(cf._schema));
auto pruned = make_lw_shared<sstables::sstable_set>(cf._compaction_strategy.make_sstable_set(cf._schema));
for (auto& p : *cf._sstables->all()) {
if (p->max_data_age() <= gc_trunc) {

View File

@@ -54,7 +54,7 @@ static void broken_sst(sstring dir, unsigned long generation, schema_ptr s, sstr
static void broken_sst(sstring dir, unsigned long generation, sstring msg) {
// Using an empty schema for this function, which is only about loading
// a malformed component and checking that it fails.
auto s = make_lw_shared(schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type));
auto s = make_shared_schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type);
return broken_sst(dir, generation, s, msg);
}

View File

@@ -138,7 +138,7 @@ SEASTAR_TEST_CASE(test_commitlog_written_to_disk_no_sync){
SEASTAR_TEST_CASE(test_commitlog_written_to_disk_periodic){
return cl_test([](commitlog& log) {
auto state = make_lw_shared(false);
auto state = make_lw_shared<bool>(false);
auto uuid = utils::UUID_gen::get_time_UUID();
return do_until([state]() {return *state;},
[&log, state, uuid]() {

View File

@@ -114,8 +114,8 @@ with_column_family(schema_ptr s, column_family::config cfg, noncopyable_function
SEASTAR_TEST_CASE(test_mutation_is_applied) {
return seastar::async([] {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}}, {{"r1", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}}, {{"r1", int32_type}}, {}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
@@ -139,10 +139,10 @@ SEASTAR_TEST_CASE(test_mutation_is_applied) {
}
SEASTAR_TEST_CASE(test_multi_level_row_tombstones) {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}},
{{"c1", int32_type}, {"c2", int32_type}, {"c3", int32_type}},
{{"r1", int32_type}}, {}, utf8_type));
{{"r1", int32_type}}, {}, utf8_type);
auto ttl = gc_clock::now() + std::chrono::seconds(1);
@@ -174,8 +174,8 @@ SEASTAR_TEST_CASE(test_multi_level_row_tombstones) {
}
SEASTAR_TEST_CASE(test_row_tombstone_updates) {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}, {"c2", int32_type}}, {{"r1", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}, {"c2", int32_type}}, {{"r1", int32_type}}, {}, utf8_type);
auto key = partition_key::from_exploded(*s, {to_bytes("key1")});
auto c_key1 = clustering_key::from_deeply_exploded(*s, {1, 0});
@@ -217,8 +217,8 @@ collection_mutation_description make_collection_mutation(tombstone t, bytes key1
SEASTAR_TEST_CASE(test_map_mutations) {
return seastar::async([] {
auto my_map_type = map_type_impl::get_instance(int32_type, utf8_type, true);
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}}, {}, {{"s1", my_map_type}}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}}, {}, {{"s1", my_map_type}}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
auto key = partition_key::from_exploded(*s, {to_bytes("key1")});
auto& column = *s->get_column_definition("s1");
@@ -253,8 +253,8 @@ SEASTAR_TEST_CASE(test_map_mutations) {
SEASTAR_TEST_CASE(test_set_mutations) {
return seastar::async([] {
auto my_set_type = set_type_impl::get_instance(int32_type, true);
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}}, {}, {{"s1", my_set_type}}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}}, {}, {{"s1", my_set_type}}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
auto key = partition_key::from_exploded(*s, {to_bytes("key1")});
auto& column = *s->get_column_definition("s1");
@@ -289,8 +289,8 @@ SEASTAR_TEST_CASE(test_set_mutations) {
SEASTAR_TEST_CASE(test_list_mutations) {
return seastar::async([] {
auto my_list_type = list_type_impl::get_instance(int32_type, true);
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}}, {}, {{"s1", my_list_type}}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}}, {}, {{"s1", my_list_type}}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
auto key = partition_key::from_exploded(*s, {to_bytes("key1")});
auto& column = *s->get_column_definition("s1");
@@ -330,8 +330,8 @@ SEASTAR_THREAD_TEST_CASE(test_udt_mutations) {
{int32_type, utf8_type, long_type, utf8_type},
true);
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}}, {}, {{"s1", ut}}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}}, {}, {{"s1", ut}}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
auto key = partition_key::from_exploded(*s, {to_bytes("key1")});
auto& column = *s->get_column_definition("s1");
@@ -489,8 +489,8 @@ SEASTAR_THREAD_TEST_CASE(test_large_collection_serialization_exception_safety) {
SEASTAR_TEST_CASE(test_multiple_memtables_one_partition) {
return seastar::async([] {
storage_service_for_tests ssft;
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}}, {{"r1", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", int32_type}}, {{"r1", int32_type}}, {}, utf8_type);
auto cf_stats = make_lw_shared<::cf_stats>();
column_family::config cfg = column_family_test_config();
@@ -618,8 +618,8 @@ SEASTAR_TEST_CASE(test_flush_in_the_middle_of_a_scan) {
SEASTAR_TEST_CASE(test_multiple_memtables_multiple_partitions) {
return seastar::async([] {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", int32_type}}, {{"c1", int32_type}}, {{"r1", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", int32_type}}, {{"c1", int32_type}}, {{"r1", int32_type}}, {}, utf8_type);
auto cf_stats = make_lw_shared<::cf_stats>();
@@ -1157,8 +1157,8 @@ SEASTAR_TEST_CASE(test_mutation_diff) {
SEASTAR_TEST_CASE(test_large_blobs) {
return seastar::async([] {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {{"s1", bytes_type}}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {{"s1", bytes_type}}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
@@ -1770,8 +1770,8 @@ SEASTAR_TEST_CASE(test_trim_rows) {
SEASTAR_TEST_CASE(test_collection_cell_diff) {
return seastar::async([] {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p", utf8_type}}, {}, {{"v", list_type_impl::get_instance(bytes_type, true)}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p", utf8_type}}, {}, {{"v", list_type_impl::get_instance(bytes_type, true)}}, {}, utf8_type);
auto& col = s->column_at(column_kind::regular_column, 0);
auto k = dht::decorate_key(*s, partition_key::from_single_value(*s, to_bytes("key")));

View File

@@ -103,8 +103,8 @@ SEASTAR_TEST_CASE(datafile_generation_01) {
// INSERT INTO test (p1, c1, r1) VALUES ('key1', 'abc', 1);
return test_setup::do_with_tmp_directory([] (test_env& env, sstring tmpdir_path) {
schema_builder builder(make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}, {"r2", int32_type}}, {}, utf8_type)));
schema_builder builder(make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}, {"r2", int32_type}}, {}, utf8_type));
builder.set_compressor_params(compression_parameters::no_compression());
auto s = builder.build(schema_builder::compact_storage::no);
@@ -171,8 +171,8 @@ SEASTAR_TEST_CASE(datafile_generation_02) {
// ) WITH compression = {};
// INSERT INTO table (p1, p2, c1, r1) VALUES ('key1', 'key2', 'abc', 1);
schema_builder builder(make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}, {"p2", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type)));
schema_builder builder(make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}, {"p2", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type));
builder.set_compressor_params(compression_parameters::no_compression());
auto s = builder.build(schema_builder::compact_storage::no);
@@ -241,8 +241,8 @@ SEASTAR_TEST_CASE(datafile_generation_03) {
// ) WITH compression = {};
// INSERT INTO table (p1, c1, c2, r1) VALUES ('key1', 'abc', 'cde', 1);
return test_setup::do_with_tmp_directory([] (test_env& env, sstring tmpdir_path) {
schema_builder builder(make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}, {"c2", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type)));
schema_builder builder(make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}, {"c2", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type));
builder.set_compressor_params(compression_parameters::no_compression());
auto s = builder.build(schema_builder::compact_storage::no);
@@ -312,8 +312,8 @@ SEASTAR_TEST_CASE(datafile_generation_04) {
// INSERT INTO test (p1, s1) VALUES ('key1', 10);
// INSERT INTO test (p1, c1, r1) VALUES ('key1', 'abc', 1);
return test_setup::do_with_tmp_directory([] (test_env& env, sstring tmpdir_path) {
schema_builder builder(make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {{"s1", int32_type}}, utf8_type)));
schema_builder builder(make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {{"s1", int32_type}}, utf8_type));
builder.set_compressor_params(compression_parameters::no_compression());
auto s = builder.build(schema_builder::compact_storage::no);
@@ -386,8 +386,8 @@ SEASTAR_TEST_CASE(datafile_generation_05) {
// ) WITH compression = {};
// INSERT INTO test (p1, c1, r1) VALUES ('key1', 'abc', 1) USING TTL 3600;
return test_setup::do_with_tmp_directory([] (test_env& env, sstring tmpdir_path) {
schema_builder builder(make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type)));
schema_builder builder(make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type));
builder.set_compressor_params(compression_parameters::no_compression());
auto s = builder.build(schema_builder::compact_storage::no);
@@ -461,8 +461,8 @@ SEASTAR_TEST_CASE(datafile_generation_06) {
// after flushed:
// DELETE r1 FROM test WHERE p1 = 'key1' AND c1 = 'abc';
return test_setup::do_with_tmp_directory([] (test_env& env, sstring tmpdir_path) {
schema_builder builder(make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type)));
schema_builder builder(make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type));
builder.set_compressor_params(compression_parameters::no_compression());
auto s = builder.build(schema_builder::compact_storage::no);
@@ -532,8 +532,8 @@ SEASTAR_TEST_CASE(datafile_generation_07) {
// INSERT INTO test (p1, c1, r1) VALUES ('key1', 'abc', 1);
// INSERT INTO test (p1, c1, r1) VALUES ('key2', 'cde', 1);
return test_setup::do_with_tmp_directory([] (test_env& env, sstring tmpdir_path) {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
@@ -592,8 +592,8 @@ SEASTAR_TEST_CASE(datafile_generation_08) {
// PRIMARY KEY (p1, c1)
// ) WITH compression = {};
return test_setup::do_with_tmp_directory([] (test_env& env, sstring tmpdir_path) {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", int32_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", int32_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
@@ -654,8 +654,8 @@ SEASTAR_TEST_CASE(datafile_generation_08) {
SEASTAR_TEST_CASE(datafile_generation_09) {
// Test that generated sstable components can be successfully loaded.
return test_setup::do_with_tmp_directory([] (test_env& env, sstring tmpdir_path) {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
@@ -699,8 +699,8 @@ static future<> test_digest_and_checksum(sstable_version_types version) {
// Check that the component Digest was properly generated by using the
// approach described above.
return test_setup::do_with_tmp_directory([version] (test_env& env, sstring tmpdir_path) {
schema_builder builder(make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type)));
schema_builder builder(make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type));
builder.set_compressor_params(compression_parameters::no_compression());
auto s = builder.build(schema_builder::compact_storage::no);
@@ -1040,8 +1040,8 @@ SEASTAR_TEST_CASE(compaction_manager_test) {
return test_env::do_with_async([] (test_env& env) {
storage_service_for_tests ssft;
BOOST_REQUIRE(smp::count == 1);
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type);
auto cm = make_lw_shared<compaction_manager>();
cm->enable();
@@ -1143,7 +1143,7 @@ SEASTAR_TEST_CASE(compact) {
// john | 20 | deleted
// nadav - deleted partition
return open_sstable(env, s, tmpdir_path, generation).then([s] (shared_sstable sst) {
auto reader = make_lw_shared(sstable_reader(sst, s)); // reader holds sst and s alive.
auto reader = make_lw_shared<flat_mutation_reader>(sstable_reader(sst, s)); // reader holds sst and s alive.
return read_mutation_from_flat_mutation_reader(*reader, db::no_timeout).then([reader, s] (mutation_opt m) {
BOOST_REQUIRE(m);
BOOST_REQUIRE(m->key().equal(*s, partition_key::from_singular(*s, data_value(sstring("jerry")))));
@@ -1217,8 +1217,8 @@ static std::vector<sstables::shared_sstable> get_candidates_for_leveled_strategy
static future<std::vector<unsigned long>> compact_sstables(test_env& env, sstring tmpdir_path, std::vector<unsigned long> generations_to_compact,
unsigned long new_generation, bool create_sstables, uint64_t min_sstable_size, compaction_strategy_type strategy) {
BOOST_REQUIRE(smp::count == 1);
schema_builder builder(make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", utf8_type}}, {}, utf8_type)));
schema_builder builder(make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", utf8_type}}, {}, utf8_type));
builder.set_compressor_params(compression_parameters::no_compression());
builder.set_min_compaction_threshold(4);
auto s = builder.build(schema_builder::compact_storage::no);
@@ -1321,8 +1321,8 @@ static future<> compact_sstables(test_env& env, sstring tmpdir_path, std::vector
}
static future<> check_compacted_sstables(test_env& env, sstring tmpdir_path, unsigned long generation, std::vector<unsigned long> compacted_generations) {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type);
auto generations = make_lw_shared<std::vector<unsigned long>>(std::move(compacted_generations));
@@ -1512,9 +1512,9 @@ SEASTAR_TEST_CASE(datafile_generation_40) {
// INSERT INTO table (p1, c1, r1) VALUES ('key1', 'b', 1);
auto s = [] {
schema_builder builder(make_lw_shared(schema({}, some_keyspace, some_column_family,
schema_builder builder(make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", reversed_type_impl::get_instance(utf8_type)}}, {{"r1", int32_type}}, {}, utf8_type
)));
));
builder.set_compressor_params(compression_parameters::no_compression());
return builder.build(schema_builder::compact_storage::yes);
}();
@@ -1562,8 +1562,8 @@ SEASTAR_TEST_CASE(datafile_generation_40) {
SEASTAR_TEST_CASE(datafile_generation_41) {
return test_setup::do_with_tmp_directory([] (test_env& env, sstring tmpdir_path) {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}, {"r2", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}, {"r2", int32_type}}, {}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
@@ -1599,8 +1599,8 @@ SEASTAR_TEST_CASE(check_compaction_ancestor_metadata) {
return test_setup::do_with_tmp_directory([] (test_env& env, sstring tmpdir_path) {
return compact_sstables(env, tmpdir_path, { 42, 43, 44, 45 }, 46).then([&env, tmpdir_path] {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", utf8_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", utf8_type}}, {}, utf8_type);
return open_sstable(env, s, tmpdir_path, 46).then([] (shared_sstable sst) {
std::set<unsigned long> ancestors;
const compaction_metadata& cm = sst->get_compaction_metadata();
@@ -1621,8 +1621,8 @@ SEASTAR_TEST_CASE(check_compaction_ancestor_metadata) {
SEASTAR_TEST_CASE(datafile_generation_47) {
// Tests the problem in which the sstable row parser would hang.
return test_setup::do_with_tmp_directory([] (test_env& env, sstring tmpdir_path) {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", utf8_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", utf8_type}}, {}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
@@ -1637,7 +1637,7 @@ SEASTAR_TEST_CASE(datafile_generation_47) {
auto sst = env.make_sstable(s, tmpdir_path, 47, la, big);
return write_memtable_to_sstable_for_test(*mt, sst).then([&env, s, tmpdir_path] {
return env.reusable_sst(s, tmpdir_path, 47).then([s] (auto sstp) mutable {
auto reader = make_lw_shared(sstable_reader(sstp, s));
auto reader = make_lw_shared<flat_mutation_reader>(sstable_reader(sstp, s));
return repeat([reader] {
return (*reader)(db::no_timeout).then([] (mutation_fragment_opt m) {
if (!m) {
@@ -2078,8 +2078,8 @@ SEASTAR_TEST_CASE(leveled_invariant_fix) {
SEASTAR_TEST_CASE(leveled_stcs_on_L0) {
test_env env;
schema_builder builder(make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {}, utf8_type)));
schema_builder builder(make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {}, utf8_type));
builder.set_min_compaction_threshold(4);
auto s = builder.build(schema_builder::compact_storage::no);
@@ -2254,7 +2254,7 @@ SEASTAR_TEST_CASE(tombstone_purge_test) {
};
auto assert_that_produces_dead_cell = [&] (auto& sst, partition_key& key) {
auto reader = make_lw_shared(sstable_reader(sst, s));
auto reader = make_lw_shared<flat_mutation_reader>(sstable_reader(sst, s));
read_mutation_from_flat_mutation_reader(*reader, db::no_timeout).then([reader, s, &key] (mutation_opt m) {
BOOST_REQUIRE(m);
BOOST_REQUIRE(m->key().equal(*s, key));
@@ -2430,7 +2430,7 @@ SEASTAR_TEST_CASE(check_multi_schema) {
auto sst = env.make_sstable(s, get_test_dir("multi_schema_test", s), 1, version, big);
auto f = sst->load();
return f.then([sst, s] {
auto reader = make_lw_shared(sstable_reader(sst, s));
auto reader = make_lw_shared<flat_mutation_reader>(sstable_reader(sst, s));
return read_mutation_from_flat_mutation_reader(*reader, db::no_timeout).then([reader, s] (mutation_opt m) {
BOOST_REQUIRE(m);
BOOST_REQUIRE(m->key().equal(*s, partition_key::from_singular(*s, 0)));
@@ -2455,8 +2455,8 @@ SEASTAR_TEST_CASE(check_multi_schema) {
SEASTAR_TEST_CASE(sstable_rewrite) {
BOOST_REQUIRE(smp::count == 1);
return test_setup::do_with_tmp_directory([] (test_env& env, sstring tmpdir_path) {
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", utf8_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", utf8_type}}, {}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
@@ -2490,7 +2490,7 @@ SEASTAR_TEST_CASE(sstable_rewrite) {
BOOST_REQUIRE(new_tables->size() == 1);
auto newsst = (*new_tables)[0];
BOOST_REQUIRE(newsst->generation() == 52);
auto reader = make_lw_shared(sstable_reader(newsst, s));
auto reader = make_lw_shared<flat_mutation_reader>(sstable_reader(newsst, s));
return (*reader)(db::no_timeout).then([s, reader, key] (mutation_fragment_opt m) {
BOOST_REQUIRE(m);
BOOST_REQUIRE(m->is_partition_start());
@@ -2979,8 +2979,8 @@ SEASTAR_TEST_CASE(compaction_with_fully_expired_table) {
}
SEASTAR_TEST_CASE(basic_date_tiered_strategy_test) {
schema_builder builder(make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {}, utf8_type)));
schema_builder builder(make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {}, utf8_type));
builder.set_min_compaction_threshold(4);
auto s = builder.build(schema_builder::compact_storage::no);
test_env env;
@@ -3016,8 +3016,8 @@ SEASTAR_TEST_CASE(basic_date_tiered_strategy_test) {
}
SEASTAR_TEST_CASE(date_tiered_strategy_test_2) {
schema_builder builder(make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {}, utf8_type)));
schema_builder builder(make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {}, utf8_type));
builder.set_min_compaction_threshold(4);
auto s = builder.build(schema_builder::compact_storage::no);
test_env env;
@@ -3841,8 +3841,8 @@ SEASTAR_TEST_CASE(size_tiered_beyond_max_threshold_test) {
SEASTAR_TEST_CASE(sstable_set_incremental_selector) {
test_env env;
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {}, utf8_type);
auto cs = sstables::make_compaction_strategy(sstables::compaction_strategy_type::leveled, s->compaction_strategy_options());
auto key_and_token_pair = token_generation_for_current_shard(8);
auto decorated_keys = boost::copy_range<std::vector<dht::decorated_key>>(
@@ -3904,8 +3904,8 @@ SEASTAR_TEST_CASE(sstable_set_incremental_selector) {
SEASTAR_TEST_CASE(sstable_set_erase) {
test_env env;
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {}, utf8_type);
auto key_and_token_pair = token_generation_for_current_shard(1);
// check that sstable_set::erase is capable of working properly when a non-existing element is given.
@@ -4023,8 +4023,8 @@ SEASTAR_TEST_CASE(sstable_expired_data_ratio) {
return test_env::do_with_async([] (test_env& env) {
storage_service_for_tests ssft;
auto tmp = tmpdir();
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", utf8_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", utf8_type}}, {}, utf8_type);
auto mt = make_lw_shared<memtable>(s);
@@ -4191,8 +4191,8 @@ SEASTAR_TEST_CASE(sstable_owner_shards) {
SEASTAR_TEST_CASE(test_summary_entry_spanning_more_keys_than_min_interval) {
return test_env::do_with_async([] (test_env& env) {
storage_service_for_tests ssft;
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", int32_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", int32_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type);
const column_definition& r1_col = *s->get_column_definition("r1");
std::vector<mutation> mutations;
@@ -5439,7 +5439,7 @@ SEASTAR_TEST_CASE(purged_tombstone_consumer_sstable_test) {
auto ttl = 5;
auto assert_that_produces_purged_tombstone = [&] (auto& sst, partition_key& key, tombstone tomb) {
auto reader = make_lw_shared(sstable_reader(sst, s));
auto reader = make_lw_shared<flat_mutation_reader>(sstable_reader(sst, s));
read_mutation_from_flat_mutation_reader(*reader, db::no_timeout).then([reader, s, &key, is_tombstone_purgeable, &tomb] (mutation_opt m) {
BOOST_REQUIRE(m);
BOOST_REQUIRE(m->key().equal(*s, key));
@@ -5850,8 +5850,8 @@ SEASTAR_TEST_CASE(test_bug_6472) {
SEASTAR_TEST_CASE(sstable_needs_cleanup_test) {
test_env env;
auto s = make_lw_shared(schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {}, utf8_type));
auto s = make_shared_schema({}, some_keyspace, some_column_family,
{{"p1", utf8_type}}, {}, {}, {}, utf8_type);
auto tokens = token_generation_for_current_shard(10);

View File

@@ -34,7 +34,7 @@
schema_ptr test_table_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema(
schema_builder builder(make_shared_schema(
generate_legacy_id("ks", "cf"), "ks", "cf",
// partition key
{{"p", bytes_type}},
@@ -48,7 +48,7 @@ schema_ptr test_table_schema() {
bytes_type,
// comment
""
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return s;

View File

@@ -405,8 +405,8 @@ SEASTAR_TEST_CASE(test_sstable_can_write_and_read_range_tombstone) {
auto wait_bg = seastar::defer([] { sstables::await_background_jobs().get(); });
storage_service_for_tests ssft;
auto dir = tmpdir();
auto s = make_lw_shared(schema({}, "ks", "cf",
{{"p1", utf8_type}}, {{"c1", int32_type}}, {{"r1", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, "ks", "cf",
{{"p1", utf8_type}}, {{"c1", int32_type}}, {{"r1", int32_type}}, {}, utf8_type);
auto key = partition_key::from_exploded(*s, {to_bytes(make_local_key(s))});
auto c_key_start = clustering_key::from_exploded(*s, {int32_type->decompose(1)});
@@ -541,7 +541,7 @@ SEASTAR_THREAD_TEST_CASE(broken_ranges_collection) {
static schema_ptr tombstone_overlap_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id("try1", "tab"), "try1", "tab",
schema_builder builder(make_shared_schema(generate_legacy_id("try1", "tab"), "try1", "tab",
// partition key
{{"pk", utf8_type}},
// clustering key
@@ -554,7 +554,7 @@ static schema_ptr tombstone_overlap_schema() {
utf8_type,
// comment
""
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return s;
@@ -700,7 +700,7 @@ SEASTAR_THREAD_TEST_CASE(range_tombstone_reading) {
// ["aaa:bbb:!","aaa:!",1459438519943668,"t",1459438519]]}
static schema_ptr tombstone_overlap_schema2() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id("try1", "tab2"), "try1", "tab2",
schema_builder builder(make_shared_schema(generate_legacy_id("try1", "tab2"), "try1", "tab2",
// partition key
{{"pk", utf8_type}},
// clustering key
@@ -713,7 +713,7 @@ static schema_ptr tombstone_overlap_schema2() {
utf8_type,
// comment
""
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return s;
@@ -781,7 +781,7 @@ SEASTAR_THREAD_TEST_CASE(tombstone_in_tombstone2) {
// Reproducer for #4783
static schema_ptr buffer_overflow_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id("test_ks", "test_tab"), "test_ks", "test_tab",
schema_builder builder(make_shared_schema(generate_legacy_id("test_ks", "test_tab"), "test_ks", "test_tab",
// partition key
{{"pk", int32_type}},
// clustering key
@@ -794,7 +794,7 @@ static schema_ptr buffer_overflow_schema() {
utf8_type,
// comment
""
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return s;

View File

@@ -58,7 +58,7 @@ SEASTAR_TEST_CASE(uncompressed_data) {
}
SEASTAR_TEST_CASE(compressed_data) {
auto s = make_lw_shared(schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type));
auto s = make_shared_schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type);
return test_using_working_sst(std::move(s), "test/resource/sstables/compressed", 1);
}
@@ -233,7 +233,7 @@ static future<> compare_files(sstdesc file1, sstdesc file2, component_type compo
static future<> check_component_integrity(component_type component) {
auto tmp = make_lw_shared<tmpdir>();
auto s = make_lw_shared(schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type));
auto s = make_shared_schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type);
return write_sst_info(s, "test/resource/sstables/compressed", tmp->path().string(), 1).then([component, tmp] {
return compare_files(sstdesc{"test/resource/sstables/compressed", 1 },
sstdesc{tmp->path().string(), 2 },
@@ -257,7 +257,7 @@ write_and_validate_sst(schema_ptr s, sstring dir, Func&& func) {
}
SEASTAR_TEST_CASE(check_summary_func) {
auto s = make_lw_shared(schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type));
auto s = make_shared_schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type);
return write_and_validate_sst(std::move(s), "test/resource/sstables/compressed", [] (shared_sstable sst1, shared_sstable sst2) {
return sstables::test(sst2).read_summary().then([sst1, sst2] {
summary& sst1_s = sstables::test(sst1).get_summary();
@@ -278,7 +278,7 @@ SEASTAR_TEST_CASE(check_filter_func) {
}
SEASTAR_TEST_CASE(check_statistics_func) {
auto s = make_lw_shared(schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type));
auto s = make_shared_schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type);
return write_and_validate_sst(std::move(s), "test/resource/sstables/compressed", [] (shared_sstable sst1, shared_sstable sst2) {
return sstables::test(sst2).read_statistics().then([sst1, sst2] {
statistics& sst1_s = sstables::test(sst1).get_statistics();
@@ -297,7 +297,7 @@ SEASTAR_TEST_CASE(check_statistics_func) {
}
SEASTAR_TEST_CASE(check_toc_func) {
auto s = make_lw_shared(schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type));
auto s = make_shared_schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type);
return write_and_validate_sst(std::move(s), "test/resource/sstables/compressed", [] (shared_sstable sst1, shared_sstable sst2) {
return sstables::test(sst2).read_toc().then([sst1, sst2] {
auto& sst1_c = sstables::test(sst1).get_components();
@@ -321,7 +321,7 @@ SEASTAR_TEST_CASE(uncompressed_random_access_read) {
}
SEASTAR_TEST_CASE(compressed_random_access_read) {
auto s = make_lw_shared(schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type));
auto s = make_shared_schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type);
return test_using_reusable_sst(std::move(s), "test/resource/sstables/compressed", 1, [] (auto sstp) {
return sstables::test(sstp).data_read(97, 6).then([sstp] (temporary_buffer<char> buf) {
BOOST_REQUIRE(sstring(buf.get(), buf.size()) == "gustaf");
@@ -433,7 +433,7 @@ SEASTAR_TEST_CASE(uncompressed_rows_read_one) {
}
SEASTAR_TEST_CASE(compressed_rows_read_one) {
auto s = make_lw_shared(schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type));
auto s = make_shared_schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type);
return test_using_reusable_sst(std::move(s), "test/resource/sstables/compressed", 1, [] (auto sstp) {
return do_with(test_row_consumer(1418654707438005), [sstp] (auto& c) {
auto context = data_consume_rows<data_consume_rows_context>(*uncompressed_schema(), sstp, c, {0, 95}, 95);
@@ -517,7 +517,7 @@ SEASTAR_TEST_CASE(uncompressed_rows_read_all) {
}
SEASTAR_TEST_CASE(compressed_rows_read_all) {
auto s = make_lw_shared(schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type));
auto s = make_shared_schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type);
return test_using_reusable_sst(std::move(s), "test/resource/sstables/compressed", 1, [] (auto sstp) {
return do_with(count_row_consumer(), [sstp] (auto& c) {
auto context = data_consume_rows<data_consume_rows_context>(*uncompressed_schema(), sstp, c);
@@ -909,7 +909,7 @@ SEASTAR_TEST_CASE(statistics_rewrite) {
static schema_ptr large_partition_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema(
schema_builder builder(make_shared_schema(
generate_legacy_id("try1", "data"), "try1", "data",
// partition key
{{"t1", utf8_type}},
@@ -923,7 +923,7 @@ static schema_ptr large_partition_schema() {
utf8_type,
// comment
""
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return s;

View File

@@ -81,7 +81,7 @@ inline sstring get_test_dir(const sstring& name, const schema_ptr s)
inline schema_ptr composite_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema({}, "tests", "composite",
schema_builder builder(make_shared_schema({}, "tests", "composite",
// partition key
{{"name", bytes_type}, {"col1", bytes_type}},
// clustering key
@@ -94,7 +94,7 @@ inline schema_ptr composite_schema() {
utf8_type,
// comment
"Table with a composite key as pkey"
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return s;
@@ -103,7 +103,7 @@ inline schema_ptr composite_schema() {
inline schema_ptr set_schema() {
static thread_local auto s = [] {
auto my_set_type = set_type_impl::get_instance(bytes_type, false);
schema_builder builder(make_lw_shared(schema({}, "tests", "set_pk",
schema_builder builder(make_shared_schema({}, "tests", "set_pk",
// partition key
{{"ss", my_set_type}},
// clustering key
@@ -118,7 +118,7 @@ inline schema_ptr set_schema() {
utf8_type,
// comment
"Table with a set as pkeys"
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return s;
@@ -127,7 +127,7 @@ inline schema_ptr set_schema() {
inline schema_ptr map_schema() {
static thread_local auto s = [] {
auto my_map_type = map_type_impl::get_instance(bytes_type, bytes_type, false);
schema_builder builder(make_lw_shared(schema({}, "tests", "map_pk",
schema_builder builder(make_shared_schema({}, "tests", "map_pk",
// partition key
{{"ss", my_map_type}},
// clustering key
@@ -142,7 +142,7 @@ inline schema_ptr map_schema() {
utf8_type,
// comment
"Table with a map as pkeys"
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return s;
@@ -151,7 +151,7 @@ inline schema_ptr map_schema() {
inline schema_ptr list_schema() {
static thread_local auto s = [] {
auto my_list_type = list_type_impl::get_instance(bytes_type, false);
schema_builder builder(make_lw_shared(schema({}, "tests", "list_pk",
schema_builder builder(make_shared_schema({}, "tests", "list_pk",
// partition key
{{"ss", my_list_type}},
// clustering key
@@ -166,7 +166,7 @@ inline schema_ptr list_schema() {
utf8_type,
// comment
"Table with a list as pkeys"
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return s;
@@ -174,7 +174,7 @@ inline schema_ptr list_schema() {
inline schema_ptr uncompressed_schema(int32_t min_index_interval = 0) {
auto uncompressed = [=] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id("ks", "uncompressed"), "ks", "uncompressed",
schema_builder builder(make_shared_schema(generate_legacy_id("ks", "uncompressed"), "ks", "uncompressed",
// partition key
{{"name", utf8_type}},
// clustering key
@@ -187,7 +187,7 @@ inline schema_ptr uncompressed_schema(int32_t min_index_interval = 0) {
utf8_type,
// comment
"Uncompressed data"
)));
));
builder.set_compressor_params(compression_parameters());
if (min_index_interval) {
builder.set_min_index_interval(min_index_interval);
@@ -209,7 +209,7 @@ inline schema_ptr complex_schema() {
auto my_fset_type = set_type_impl::get_instance(bytes_type, false);
auto my_set_static_type = set_type_impl::get_instance(bytes_type, true);
schema_builder builder(make_lw_shared(schema({}, "tests", "complex_schema",
schema_builder builder(make_shared_schema({}, "tests", "complex_schema",
// partition key
{{"key", bytes_type}},
// clustering key
@@ -228,7 +228,7 @@ inline schema_ptr complex_schema() {
bytes_type,
// comment
"Table with a complex schema, including collections and static keys"
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return s;
@@ -236,7 +236,7 @@ inline schema_ptr complex_schema() {
inline schema_ptr columns_schema() {
static thread_local auto columns = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id("name", "columns"), "name", "columns",
schema_builder builder(make_shared_schema(generate_legacy_id("name", "columns"), "name", "columns",
// partition key
{{"keyspace_name", utf8_type}},
// clustering key
@@ -256,7 +256,7 @@ inline schema_ptr columns_schema() {
utf8_type,
// comment
"column definitions"
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return columns;
@@ -264,7 +264,7 @@ inline schema_ptr columns_schema() {
inline schema_ptr compact_simple_dense_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema({}, "tests", "compact_simple_dense",
schema_builder builder(make_shared_schema({}, "tests", "compact_simple_dense",
// partition key
{{"ks", bytes_type}},
// clustering key
@@ -277,7 +277,7 @@ inline schema_ptr compact_simple_dense_schema() {
utf8_type,
// comment
"Table with a compact storage, and a single clustering key"
)));
));
return builder.build(schema_builder::compact_storage::yes);
}();
return s;
@@ -285,7 +285,7 @@ inline schema_ptr compact_simple_dense_schema() {
inline schema_ptr compact_dense_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema({}, "tests", "compact_simple_dense",
schema_builder builder(make_shared_schema({}, "tests", "compact_simple_dense",
// partition key
{{"ks", bytes_type}},
// clustering key
@@ -298,7 +298,7 @@ inline schema_ptr compact_dense_schema() {
utf8_type,
// comment
"Table with a compact storage, and a compound clustering key"
)));
));
return builder.build(schema_builder::compact_storage::yes);
}();
return s;
@@ -306,7 +306,7 @@ inline schema_ptr compact_dense_schema() {
inline schema_ptr compact_sparse_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema({}, "tests", "compact_sparse",
schema_builder builder(make_shared_schema({}, "tests", "compact_sparse",
// partition key
{{"ks", bytes_type}},
// clustering key
@@ -322,7 +322,7 @@ inline schema_ptr compact_sparse_schema() {
utf8_type,
// comment
"Table with a compact storage, but no clustering keys"
)));
));
return builder.build(schema_builder::compact_storage::yes);
}();
return s;
@@ -334,7 +334,7 @@ inline schema_ptr compact_sparse_schema() {
// sure we are testing the exact some one we have in our test dir.
inline schema_ptr peers_schema() {
static thread_local auto peers = [] {
schema_builder builder(make_lw_shared(schema(generate_legacy_id("system", "peers"), "system", "peers",
schema_builder builder(make_shared_schema(generate_legacy_id("system", "peers"), "system", "peers",
// partition key
{{"peer", inet_addr_type}},
// clustering key
@@ -356,7 +356,7 @@ inline schema_ptr peers_schema() {
utf8_type,
// comment
"information about known peers in the cluster"
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return peers;

View File

@@ -43,7 +43,7 @@ using namespace std::literals::chrono_literals;
schema_ptr test_table_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema(
schema_builder builder(make_shared_schema(
generate_legacy_id("try1", "data"), "try1", "data",
// partition key
{{"p", utf8_type}},
@@ -57,7 +57,7 @@ schema_ptr test_table_schema() {
utf8_type,
// comment
""
)));
));
return builder.build(schema_builder::compact_storage::no);
}();
return s;

View File

@@ -233,7 +233,7 @@ public:
virtual future<> create_table(std::function<schema(std::string_view)> schema_maker) override {
auto id = utils::UUID_gen::get_time_UUID();
schema_builder builder(make_lw_shared(schema_maker(ks_name)));
schema_builder builder(make_lw_shared<schema>(schema_maker(ks_name)));
builder.set_uuid(id);
auto s = builder.build(schema_builder::compact_storage::no);
return service::get_local_migration_manager().announce_new_column_family(s, true);

View File

@@ -31,8 +31,8 @@ static atomic_cell make_atomic_cell(data_type dt, bytes value) {
int main(int argc, char* argv[]) {
return app_template().run_deprecated(argc, argv, [] {
auto s = make_lw_shared(schema({}, "ks", "cf",
{{"p1", utf8_type}}, {{"c1", int32_type}}, {{"r1", int32_type}}, {}, utf8_type));
auto s = make_shared_schema({}, "ks", "cf",
{{"p1", utf8_type}}, {{"c1", int32_type}}, {{"r1", int32_type}}, {}, utf8_type);
memtable mt(s);

View File

@@ -81,7 +81,7 @@ private:
columns.push_back(schema::column{ to_bytes(format("column{:04d}", i)), utf8_type });
}
schema_builder builder(make_lw_shared(schema(generate_legacy_id("ks", "perf-test"), "ks", "perf-test",
schema_builder builder(make_shared_schema(generate_legacy_id("ks", "perf-test"), "ks", "perf-test",
// partition key
{{"name", utf8_type}},
// clustering key
@@ -94,7 +94,7 @@ private:
utf8_type,
// comment
"Perf tests"
)));
));
return builder.build(schema_builder::compact_storage::no);
}