query-result-writer: reorder initialization to prevent use-after-move

Reorder member variable initialization sequence to ensure `pw` is accessed
before being moved. While the current use-after-move warning from clang-tidy
is a false positive, this change:
- Makes the initialization order more logical
- Eliminates misleading static analysis warnings
- Prevents potential future issues if class structure changes

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#22830
This commit is contained in:
Kefu Chai
2025-02-13 10:02:53 +08:00
committed by Pavel Emelyanov
parent 5693c18637
commit 3cf0f71420
2 changed files with 2 additions and 2 deletions

View File

@@ -1876,8 +1876,8 @@ mutation_querier::mutation_querier(const schema& s, query::result::partition_wri
query::result_memory_accounter& memory_accounter)
: _schema(s)
, _memory_accounter(memory_accounter)
, _pw(std::move(pw))
, _static_cells_wr(pw.start().start_static_row().start_cells())
, _pw(std::move(pw))
{
}

View File

@@ -202,8 +202,8 @@ class range_tombstone_change;
class mutation_querier {
const schema& _schema;
query::result_memory_accounter& _memory_accounter;
query::result::partition_writer _pw;
ser::qr_partition__static_row__cells<bytes_ostream> _static_cells_wr;
query::result::partition_writer _pw;
bool _live_data_in_static_row{};
uint64_t _live_clustering_rows = 0;
std::optional<ser::qr_partition__rows<bytes_ostream>> _rows_wr;