From 78b93b21b30dd7aa6bf41ffcf1dd58b386d2145d Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Tue, 26 May 2015 15:24:49 -0400 Subject: [PATCH] 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 --- sstables/sstables.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sstables/sstables.cc b/sstables/sstables.cc index 611da024fb..0df91b76cd 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -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& 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); }); }); }