From 3e605f1c8ca2c179b2704ad2b2068fc5c5c7dacc Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Thu, 30 Apr 2015 10:05:36 +0300 Subject: [PATCH 1/3] service: Fix storage_proxy::query_local() to return clustering keys Spotted by Tomek. Signed-off-by: Pekka Enberg --- service/storage_proxy.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index 299f35d1d7..b4aca0afbc 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -1217,7 +1217,8 @@ storage_proxy::query_local(const sstring& ks_name, const sstring& cf_name, const std::vector regular_cols; boost::range::push_back(regular_cols, schema->regular_columns() | boost::adaptors::transformed([] (auto&& col) { return col.id; })); auto opts = query::partition_slice::option_set::of< - query::partition_slice::option::send_partition_key>(); + query::partition_slice::option::send_partition_key, + query::partition_slice::option::send_clustering_key>(); query::partition_slice slice{row_ranges, {}, regular_cols, opts}; std::vector pr = {query::partition_range::make_open_ended_both_sides()}; auto id = db.find_uuid(ks_name, cf_name); From 73928c27a5081ef7c145d4ddec38eaa702018a57 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Thu, 30 Apr 2015 10:14:32 +0300 Subject: [PATCH 2/3] service: Fix storage_proxy::query_local() to return static columns Spotted by Tomek. Signed-off-by: Pekka Enberg --- service/storage_proxy.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index b4aca0afbc..9eb3006d29 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -1216,10 +1216,12 @@ storage_proxy::query_local(const sstring& ks_name, const sstring& cf_name, const std::vector row_ranges = {query::clustering_range::make_open_ended_both_sides()}; std::vector regular_cols; boost::range::push_back(regular_cols, schema->regular_columns() | boost::adaptors::transformed([] (auto&& col) { return col.id; })); + std::vector static_cols; + boost::range::push_back(static_cols, schema->static_columns() | boost::adaptors::transformed([] (auto&& col) { return col.id; })); auto opts = query::partition_slice::option_set::of< query::partition_slice::option::send_partition_key, query::partition_slice::option::send_clustering_key>(); - query::partition_slice slice{row_ranges, {}, regular_cols, opts}; + query::partition_slice slice{row_ranges, static_cols, regular_cols, opts}; std::vector pr = {query::partition_range::make_open_ended_both_sides()}; auto id = db.find_uuid(ks_name, cf_name); auto cmd = make_lw_shared(id, pr, slice, std::numeric_limits::max()); From 26dd7c7cacf5be1515baaceaf87843abf8b7947a Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Thu, 30 Apr 2015 10:15:45 +0300 Subject: [PATCH 3/3] service: Avoid schema ID lookup in storage_proxy::query_local() It's unneeded because we already looked up the schema. Spotted by Tomek. Signed-off-by: Pekka Enberg --- service/storage_proxy.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index 9eb3006d29..9088ef6c84 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -1223,8 +1223,7 @@ storage_proxy::query_local(const sstring& ks_name, const sstring& cf_name, const query::partition_slice::option::send_clustering_key>(); query::partition_slice slice{row_ranges, static_cols, regular_cols, opts}; std::vector pr = {query::partition_range::make_open_ended_both_sides()}; - auto id = db.find_uuid(ks_name, cf_name); - auto cmd = make_lw_shared(id, pr, slice, std::numeric_limits::max()); + auto cmd = make_lw_shared(schema->id(), pr, slice, std::numeric_limits::max()); return db.query(*cmd).then([key, schema, slice](lw_shared_ptr&& result) { query::result_set_builder builder{schema}; bytes_ostream w(result->buf());