mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-21 17:10:35 +00:00
sstables: don't cast composites to bytes_view
Now that we can write composites directly, we no longer should use bytes_view. As a matter of fact, write(out, ... bytes_view(x)) is wrong, because our write function can't handle rvalue-references very well. Doing both those things, we can fix a tricky bug that showed up recently in our stress tests. Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This commit is contained in:
@@ -884,16 +884,16 @@ static future<> write_column_name(file_writer& out, const composite& clustering_
|
||||
// FIXME: This code assumes name is always composite, but it wouldn't if "WITH COMPACT STORAGE"
|
||||
// was defined in the schema, for example.
|
||||
return do_with(composite::from_exploded(column_names), [&out, &clustering_key] (composite& c) {
|
||||
uint16_t sz = bytes_view(clustering_key).size() + bytes_view(c).size();
|
||||
return write(out, sz, bytes_view(clustering_key), bytes_view(c));
|
||||
uint16_t sz = clustering_key.size() + c.size();
|
||||
return write(out, sz, clustering_key, c);
|
||||
});
|
||||
}
|
||||
|
||||
static future<> write_static_column_name(file_writer& out, const schema& schema, const std::vector<bytes_view>& column_names) {
|
||||
return do_with(composite::from_exploded(column_names), [&out, &schema] (composite& c) {
|
||||
return do_with(composite::static_prefix(schema), [&out, &c] (composite& sp) {
|
||||
uint16_t sz = bytes_view(sp).size() + bytes_view(c).size();
|
||||
return write(out, sz, bytes_view(sp), bytes_view(c));
|
||||
uint16_t sz = sp.size() + c.size();
|
||||
return write(out, sz, sp, c);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user