From cc39b54173fac3a0cd16d091aee8feb43f256e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Cybulski?= Date: Tue, 21 Apr 2026 12:41:12 +0200 Subject: [PATCH] alternator: use `stream_arn` instead of `std::string` in list_streams Use `stream_arn` object for storage of last returned to the user stream instead of raw `std::string`. `stream_arn` is used for parsing ARN incoming from the user, for returning `std::string` was used because of buggy copy / move operations of `stream_arn`. Those were fixed, so we're fixing usage as well. Fixes: SCYLLADB-1241 Closes scylladb/scylladb#29578 --- alternator/streams.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alternator/streams.cc b/alternator/streams.cc index 7e0e814c3e..398e66cbf9 100644 --- a/alternator/streams.cc +++ b/alternator/streams.cc @@ -234,7 +234,7 @@ future alternator::executor::list_str auto ret = rjson::empty_object(); auto streams = rjson::empty_array(); - std::optional last; + std::optional last; for (;limit > 0 && i != e; ++i) { auto s = i->schema(); @@ -247,11 +247,11 @@ future alternator::executor::list_str rjson::value new_entry = rjson::empty_object(); auto arn = stream_arn{ i->schema(), cdc::get_base_table(db.real_database(), *i->schema()) }; - last = std::string(arn.unparsed()); rjson::add(new_entry, "StreamArn", arn); rjson::add(new_entry, "StreamLabel", rjson::from_string(stream_label(*s))); rjson::add(new_entry, "TableName", rjson::from_string(cdc::base_name(s->cf_name()))); rjson::push_back(streams, std::move(new_entry)); + last = std::move(arn); --limit; } } @@ -263,7 +263,7 @@ future alternator::executor::list_str // If we exhausted all tables naturally (limit > 0), there are no more // streams, so we must not emit a cookie. if (last && limit == 0) { - rjson::add(ret, "LastEvaluatedStreamArn", rjson::from_string(*last)); + rjson::add(ret, "LastEvaluatedStreamArn", *last); } return make_ready_future(rjson::print(std::move(ret))); }