mutation: remove now unused query() and query_compacted()
This commit is contained in:
35
mutation.cc
35
mutation.cc
@@ -105,41 +105,6 @@ bool mutation::operator!=(const mutation& m) const {
|
|||||||
return !(*this == m);
|
return !(*this == m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
mutation::query(query::result::builder& builder,
|
|
||||||
const query::partition_slice& slice,
|
|
||||||
gc_clock::time_point now,
|
|
||||||
uint64_t row_limit) &&
|
|
||||||
{
|
|
||||||
auto pb = builder.add_partition(*schema(), key());
|
|
||||||
auto is_reversed = slice.options.contains<query::partition_slice::option::reversed>();
|
|
||||||
auto always_return_static_content = slice.options.contains<query::partition_slice::option::always_return_static_content>();
|
|
||||||
mutation_partition& p = partition();
|
|
||||||
auto limit = std::min(row_limit, slice.partition_row_limit());
|
|
||||||
p.compact_for_query(*schema(), now, slice.row_ranges(*schema(), key()), always_return_static_content, is_reversed, limit);
|
|
||||||
p.query_compacted(pb, *schema(), limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
query::result
|
|
||||||
mutation::query(const query::partition_slice& slice,
|
|
||||||
query::result_memory_accounter&& accounter,
|
|
||||||
query::result_options opts,
|
|
||||||
gc_clock::time_point now, uint64_t row_limit) &&
|
|
||||||
{
|
|
||||||
query::result::builder builder(slice, opts, std::move(accounter));
|
|
||||||
std::move(*this).query(builder, slice, now, row_limit);
|
|
||||||
return builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
query::result
|
|
||||||
mutation::query(const query::partition_slice& slice,
|
|
||||||
query::result_memory_accounter&& accounter,
|
|
||||||
query::result_options opts,
|
|
||||||
gc_clock::time_point now, uint64_t row_limit) const&
|
|
||||||
{
|
|
||||||
return mutation(*this).query(slice, std::move(accounter), opts, now, row_limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
mutation::live_row_count(gc_clock::time_point query_time) const {
|
mutation::live_row_count(gc_clock::time_point query_time) const {
|
||||||
return partition().live_row_count(*schema(), query_time);
|
return partition().live_row_count(*schema(), query_time);
|
||||||
|
|||||||
21
mutation.hh
21
mutation.hh
@@ -119,27 +119,6 @@ public:
|
|||||||
bool operator==(const mutation&) const;
|
bool operator==(const mutation&) const;
|
||||||
bool operator!=(const mutation&) const;
|
bool operator!=(const mutation&) const;
|
||||||
public:
|
public:
|
||||||
// The supplied partition_slice must be governed by this mutation's schema
|
|
||||||
query::result query(const query::partition_slice&,
|
|
||||||
query::result_memory_accounter&& accounter,
|
|
||||||
query::result_options opts = query::result_options::only_result(),
|
|
||||||
gc_clock::time_point now = gc_clock::now(),
|
|
||||||
uint64_t row_limit = query::max_rows) &&;
|
|
||||||
|
|
||||||
// The supplied partition_slice must be governed by this mutation's schema
|
|
||||||
// FIXME: Slower than the r-value version
|
|
||||||
query::result query(const query::partition_slice&,
|
|
||||||
query::result_memory_accounter&& accounter,
|
|
||||||
query::result_options opts = query::result_options::only_result(),
|
|
||||||
gc_clock::time_point now = gc_clock::now(),
|
|
||||||
uint64_t row_limit = query::max_rows) const&;
|
|
||||||
|
|
||||||
// The supplied partition_slice must be governed by this mutation's schema
|
|
||||||
void query(query::result::builder& builder,
|
|
||||||
const query::partition_slice& slice,
|
|
||||||
gc_clock::time_point now = gc_clock::now(),
|
|
||||||
uint64_t row_limit = query::max_rows) &&;
|
|
||||||
|
|
||||||
// Consumes the mutation's content.
|
// Consumes the mutation's content.
|
||||||
//
|
//
|
||||||
// The mutation is in a moved-from alike state after consumption.
|
// The mutation is in a moved-from alike state after consumption.
|
||||||
|
|||||||
@@ -908,94 +908,6 @@ bool has_any_live_data(const schema& s, column_kind kind, const row& cells, tomb
|
|||||||
return any_live;
|
return any_live;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
mutation_partition::query_compacted(query::result::partition_writer& pw, const schema& s, uint64_t limit) const {
|
|
||||||
check_schema(s);
|
|
||||||
const query::partition_slice& slice = pw.slice();
|
|
||||||
max_timestamp max_ts{pw.last_modified()};
|
|
||||||
|
|
||||||
if (limit == 0) {
|
|
||||||
pw.retract();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto static_cells_wr = pw.start().start_static_row().start_cells();
|
|
||||||
|
|
||||||
if (!slice.static_columns.empty()) {
|
|
||||||
if (pw.requested_result()) {
|
|
||||||
get_compacted_row_slice(s, slice, column_kind::static_column, static_row().get(), slice.static_columns, static_cells_wr);
|
|
||||||
}
|
|
||||||
if (pw.requested_digest()) {
|
|
||||||
auto pt = partition_tombstone();
|
|
||||||
pw.digest().feed_hash(pt);
|
|
||||||
max_ts.update(pt.timestamp);
|
|
||||||
pw.digest().feed_hash(static_row().get(), s, column_kind::static_column, slice.static_columns, max_ts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto rows_wr = std::move(static_cells_wr).end_cells()
|
|
||||||
.end_static_row()
|
|
||||||
.start_rows();
|
|
||||||
|
|
||||||
uint64_t row_count = 0;
|
|
||||||
|
|
||||||
auto is_reversed = slice.options.contains(query::partition_slice::option::reversed);
|
|
||||||
auto send_ck = slice.options.contains(query::partition_slice::option::send_clustering_key);
|
|
||||||
for_each_row(s, query::clustering_range::make_open_ended_both_sides(), is_reversed, [&] (const rows_entry& e) {
|
|
||||||
if (e.dummy()) {
|
|
||||||
return stop_iteration::no;
|
|
||||||
}
|
|
||||||
auto& row = e.row();
|
|
||||||
auto row_tombstone = tombstone_for_row(s, e);
|
|
||||||
|
|
||||||
if (pw.requested_digest()) {
|
|
||||||
pw.digest().feed_hash(e.key(), s);
|
|
||||||
pw.digest().feed_hash(row_tombstone);
|
|
||||||
max_ts.update(row_tombstone.tomb().timestamp);
|
|
||||||
pw.digest().feed_hash(row.cells(), s, column_kind::regular_column, slice.regular_columns, max_ts);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (row.is_live(s)) {
|
|
||||||
if (pw.requested_result()) {
|
|
||||||
auto cells_wr = [&] {
|
|
||||||
if (send_ck) {
|
|
||||||
return rows_wr.add().write_key(e.key()).start_cells().start_cells();
|
|
||||||
} else {
|
|
||||||
return rows_wr.add().skip_key().start_cells().start_cells();
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
get_compacted_row_slice(s, slice, column_kind::regular_column, row.cells(), slice.regular_columns, cells_wr);
|
|
||||||
std::move(cells_wr).end_cells().end_cells().end_qr_clustered_row();
|
|
||||||
}
|
|
||||||
++row_count;
|
|
||||||
if (--limit == 0) {
|
|
||||||
return stop_iteration::yes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return stop_iteration::no;
|
|
||||||
});
|
|
||||||
|
|
||||||
pw.last_modified() = max_ts.max;
|
|
||||||
|
|
||||||
// If we got no rows, but have live static columns, we should only
|
|
||||||
// give them back IFF we did not have any CK restrictions.
|
|
||||||
// #589
|
|
||||||
// If ck:s exist, and we do a restriction on them, we either have maching
|
|
||||||
// rows, or return nothing, since cql does not allow "is null".
|
|
||||||
bool return_static_content_on_partition_with_no_rows =
|
|
||||||
pw.slice().options.contains(query::partition_slice::option::always_return_static_content) ||
|
|
||||||
!has_ck_selector(pw.ranges());
|
|
||||||
if (row_count == 0
|
|
||||||
&& (!return_static_content_on_partition_with_no_rows
|
|
||||||
|| !has_any_live_data(s, column_kind::static_column, static_row().get()))) {
|
|
||||||
pw.retract();
|
|
||||||
} else {
|
|
||||||
pw.row_count() += row_count ? : 1;
|
|
||||||
pw.partition_count() += 1;
|
|
||||||
std::move(rows_wr).end_rows().end_qr_partition();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
operator<<(std::ostream& os, const std::pair<column_id, const atomic_cell_or_collection::printer&>& c) {
|
operator<<(std::ostream& os, const std::pair<column_id, const atomic_cell_or_collection::printer&>& c) {
|
||||||
return fmt_print(os, "{{column: {} {}}}", c.first, c.second);
|
return fmt_print(os, "{{column: {} {}}}", c.first, c.second);
|
||||||
|
|||||||
@@ -1479,11 +1479,6 @@ public:
|
|||||||
return boost::make_iterator_range(_rows.begin(), _rows.end())
|
return boost::make_iterator_range(_rows.begin(), _rows.end())
|
||||||
| boost::adaptors::filtered([] (const rows_entry& e) { return bool(!e.dummy()); });
|
| boost::adaptors::filtered([] (const rows_entry& e) { return bool(!e.dummy()); });
|
||||||
}
|
}
|
||||||
// Writes this partition using supplied query result writer.
|
|
||||||
// The partition should be first compacted with compact_for_query(), otherwise
|
|
||||||
// results may include data which is deleted/expired.
|
|
||||||
// At most row_limit CQL rows will be written and digested.
|
|
||||||
void query_compacted(query::result::partition_writer& pw, const schema& s, uint64_t row_limit) const;
|
|
||||||
void accept(const schema&, mutation_partition_visitor&) const;
|
void accept(const schema&, mutation_partition_visitor&) const;
|
||||||
|
|
||||||
// Returns the number of live CQL rows in this partition.
|
// Returns the number of live CQL rows in this partition.
|
||||||
|
|||||||
Reference in New Issue
Block a user