github-actions[bot] commented on code in PR #63258: URL: https://github.com/apache/doris/pull/63258#discussion_r4228568846
########## regression-test/suites/correctness_p0/test_exchange_http_send_borrowed_block.groovy: ########## @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import org.apache.doris.regression.suite.ClusterOptions + +// Forces exchange sinks to use the http-attachment path (normally reserved for +// requests >= 2G) via a debug point, so that both the unicast (shuffle) and +// broadcast exchange sink code in proto_util.h/exchange_sink_buffer.cpp that +// move/borrow column_values into the brpc attachment actually run cross-BE, +// instead of only through unit tests. +suite('test_exchange_http_send_borrowed_block', 'docker') { + def options = new ClusterOptions() + options.beNum = 2 + options.enableDebugPoints() + + docker(options) { + def tbl = 'test_exchange_http_send_borrowed_block_tbl' + + sql "DROP TABLE IF EXISTS ${tbl}" + sql """ + CREATE TABLE ${tbl} ( + k1 INT NULL, + k2 INT NULL + ) + DISTRIBUTED BY HASH(k1) BUCKETS 4 + PROPERTIES ("replication_num" = "1") + """ + sql """ + INSERT INTO ${tbl} VALUES + (1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60), (7, 70), (8, 80) + """ + + def backends = cluster.getAllBackends() + assertTrue(backends.size() == 2) + for (def be : backends) { + be.enableDebugPoint('proto_util.enable_http_send_block.always_http', null) + } + + try { + // Shuffle exchange: exercises the unicast attachment path Review Comment: [P2] Disable multi-block exchange before these HTTP regression queries. The FE defaults `exchange_multi_blocks_byte_size` to 256 KiB, so `ExchangeSinkBuffer` fills repeated `blocks` instead of the singular `block`. `enable_http_send_block` returns false on `!request.has_block()` before it checks this debug point; both queries therefore use ordinary RPC even when they pass. Set this session variable to a negative value and assert that each forced HTTP branch was reached. ########## be/src/exec/operator/exchange_sink_buffer.cpp: ########## @@ -49,6 +49,49 @@ namespace doris { +namespace exchange_sink_buffer::detail { + +void copy_block_metadata_without_column_values(const PBlock& src, PBlock* dst) { + for (int i = 0; i < src.column_metas_size(); ++i) { + dst->add_column_metas()->CopyFrom(src.column_metas(i)); + } + dst->set_be_exec_version(src.be_exec_version()); + dst->set_compressed(src.compressed()); + dst->set_compression_type(src.compression_type()); + dst->set_uncompressed_size(src.uncompressed_size()); +} + +std::shared_ptr<PTransmitDataParams> make_http_request_without_column_values( + const PTransmitDataParams& src) { + DORIS_CHECK(src.has_block()); + DORIS_CHECK(src.blocks_size() == 0); + DORIS_CHECK(!src.has_row_batch()); + + auto dst = std::make_shared<PTransmitDataParams>(); + dst->mutable_finst_id()->CopyFrom(src.finst_id()); + dst->set_node_id(src.node_id()); + dst->set_sender_id(src.sender_id()); + dst->set_be_number(src.be_number()); + dst->set_eos(src.eos()); + dst->set_packet_seq(src.packet_seq()); + if (src.has_query_statistics()) { + dst->mutable_query_statistics()->CopyFrom(src.query_statistics()); + } + if (src.has_transfer_by_attachment()) { + dst->set_transfer_by_attachment(src.transfer_by_attachment()); + } + if (src.has_query_id()) { + dst->mutable_query_id()->CopyFrom(src.query_id()); + } + if (src.has_exec_status()) { + dst->mutable_exec_status()->CopyFrom(src.exec_status()); + } + copy_block_metadata_without_column_values(src.block(), dst->mutable_block()); Review Comment: [P1] Preserve `column_values` presence in the HTTP metadata request. This new `PBlock` omits the optional field entirely. On receive, `attachment_extract_request_contain_block` takes a mutable string pointer before `ParseFromString`, then writes the attachment through that pointer; the parse clears the proto2 presence bit, and the raw string write does not restore it. `VDataStreamMgr::transmit_block` then `CopyFrom`s the block without its payload, so large broadcast sends fail or deserialize empty data. Mark the field present with an empty value in this request, or set it through the protobuf API after extraction, and cover the receive-plus-`CopyFrom` path. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
