From 0b69a1badcd83d3f4ace9101bb0d09ef3db15586 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 24 Nov 2023 13:02:31 +0800 Subject: [PATCH] transport: cast unaligned to T for formatting it in fmt v10, it does not cast unaligned to T when formatting it, instead it insists on finding a matched fmt::formatter<> specialization for it. that's why we have FTBFS with fmt v10 when printing these packed variables with fmtlib v10. in this change, we just cast them to the underlying types before formatting them. because seastar::unaligned does not provide a method for accessing the raw value, neither does it provide a type alias of the type of the underlying raw value, we have to cast to the type without deducing it from the printed value. Refs #13245 Signed-off-by: Kefu Chai Closes scylladb/scylladb#16167 --- transport/server.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/transport/server.cc b/transport/server.cc index aea5a5c2d3..f4bb26a7a6 100644 --- a/transport/server.cc +++ b/transport/server.cc @@ -381,7 +381,7 @@ cql_server::connection::read_frame() { if (frame.length > 100'000) { // The STARTUP message body is a [string map] containing just a few options, // so it should be smaller that 100kB. See #4366. - throw exceptions::protocol_exception(format("Initial message size too large ({:d}), rejecting as invalid", frame.length)); + throw exceptions::protocol_exception(format("Initial message size too large ({:d}), rejecting as invalid", uint32_t(frame.length))); } return make_ready_future(frame); }); @@ -668,7 +668,7 @@ future<> cql_server::connection::process_request() { ++_server._stats.requests_shed; return _read_buf.skip(f.length).then([this, stream = f.stream] { const char* message = "request shed due to coordinator overload"; - clogger.debug("{}: {}, stream {}", _client_state.get_remote_address(), message, stream); + clogger.debug("{}: {}, stream {}", _client_state.get_remote_address(), message, uint16_t(stream)); write_response(make_error(stream, exceptions::exception_code::OVERLOADED, message, tracing::trace_state_ptr())); return make_ready_future<>(); @@ -689,7 +689,7 @@ future<> cql_server::connection::process_request() { auto mem_estimate = f.length * 2 + 8000; // Allow for extra copies and bookkeeping if (mem_estimate > _server._max_request_size) { const auto message = format("request size too large (frame size {:d}; estimate {:d}; allowed {:d})", - f.length, mem_estimate, _server._max_request_size); + uint32_t(f.length), mem_estimate, _server._max_request_size); clogger.debug("{}: {}, request dropped", _client_state.get_remote_address(), message); write_response(make_error(stream, exceptions::exception_code::INVALID, message, tracing::trace_state_ptr())); return std::exchange(_ready_to_respond, make_ready_future<>())