mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-22 01:20:39 +00:00
As a part of the effort of removing big, contiguous buffers from the codebase, cql3::raw_value should be made fragmented. Unfortunately a straightforward rewrite to a fragmented buffer type is not possible, because we want cql3::raw_value to be compatible with cql3::raw_value_view, and we want that view to be based on fragmented_temporary_buffer::view, so that it can be used to view data coming directly from seastar without copying. This patch makes cql3::raw_value fragmented by making cql3::raw_value_view a `variant` of managed_bytes_view and fragmented_temporary_buffer::view. Code users which depended on `cql3::raw_value` being `bytes`, and cql::raw_value_view being `fragmented_temporary_buffer::view` underneath were adjusted to the new, dual representation, mainly through the `cql3::raw_value_view::with_value` visitor and deserialization/validation helpers added to `cql3::raw_value_view`. The second part of this series gets rid of linearizations occuring when processing compound types in the CQL layer. This is achieved by storing their elements in `managed_bytes` instead of `bytes` in the partially deserialized form (`lists::value` `tuples::value`, etc.) outputting `managed_bytes` instead of `bytes` in functions which go from the partially deserialized form to the atomic cell format (for frozen types), and avoiding calling deserialize/serialize on individual elements when it's not necessary. (It's only necessary for CQLv2, because since CQLv3 the format on the wire is the same as our internal one). The above also forces some changes to `expression.cc`, and `restrictions`, mainly because `IN` clauses store their arguments as `lists` and `tuples`, and the code which handled this clause expected `bytes`. After this series, the path from prepared CQL statements to `atomic_cell_or_collection` is almost completely linearization-free. The last remaining place is `collection_mutation_description`, where map keys are linearized to `bytes`. Closes #8160 * github.com:scylladb/scylla: cql3: update_parameters: remove unused version of make_cell for bytes_view types: collection: remove an unused version of pack_fragmented cql3: optimize the deserialization of collections cql3: maps, sets: switch the element type from bytes to managed_bytes cql3: expression: use managed_bytes instead of bytes where possible cql3: expr: expression: make the argument of to_range a forwarding reference cql3: don't linearize elements of lists, tuples, and user types cql3: values: add const managed_bytes& constructor to raw_value_view cql3: output managed_bytes instead of bytes in get_with_protocol_version types: collection: add versions of pack for fragmented buffers types: add write_collection_{value,size} for managed_bytes_mutable_view cql3: tuples, user_types: avoid linearization in from_serialized() and get() types: tuple: add build_value_fragmented cql3: update_parameters: add make_cell version for managed_bytes_view cql3: remove operation::make_*cell cql3: values: make raw_value fragmented cql3: values: remove raw_value_view::operator== cql3: switch users of cql3::raw_value_view to internals-independent API cql3: values: add an internals-independent API to raw_value_view utils: managed_bytes: add a managed_bytes constructor from FragmentedView utils: managed_bytes: add operator<< and to_hex for managed_bytes utils: fragment_range: add to_hex configure: remove unused link dependencies from UUID_test