Coverage Report

Created: 2026-08-03 20:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/service/http/action/http_stream.cpp
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#include "service/http/action/http_stream.h"
19
20
#include <algorithm>
21
#include <cstddef>
22
#include <future>
23
#include <sstream>
24
25
// use string iequal
26
#include <event2/buffer.h>
27
#include <event2/bufferevent.h>
28
#include <event2/http.h>
29
#include <gen_cpp/FrontendService.h>
30
#include <gen_cpp/FrontendService_types.h>
31
#include <gen_cpp/HeartbeatService_types.h>
32
#include <rapidjson/prettywriter.h>
33
#include <thrift/protocol/TDebugProtocol.h>
34
35
#include "cloud/config.h"
36
#include "common/config.h"
37
#include "common/logging.h"
38
#include "common/metrics/doris_metrics.h"
39
#include "common/metrics/metrics.h"
40
#include "common/status.h"
41
#include "common/utils.h"
42
#include "io/fs/stream_load_pipe.h"
43
#include "load/group_commit/group_commit_mgr.h"
44
#include "load/load_path_mgr.h"
45
#include "load/stream_load/new_load_stream_mgr.h"
46
#include "load/stream_load/stream_load_context.h"
47
#include "load/stream_load/stream_load_executor.h"
48
#include "load/stream_load/stream_load_recorder.h"
49
#include "runtime/exec_env.h"
50
#include "runtime/fragment_mgr.h"
51
#include "service/http/http_channel.h"
52
#include "service/http/http_common.h"
53
#include "service/http/http_headers.h"
54
#include "service/http/http_request.h"
55
#include "service/http/utils.h"
56
#include "storage/storage_engine.h"
57
#include "util/byte_buffer.h"
58
#include "util/client_cache.h"
59
#include "util/load_util.h"
60
#include "util/string_util.h"
61
#include "util/thrift_rpc_helper.h"
62
#include "util/time.h"
63
#include "util/uid_util.h"
64
65
namespace doris {
66
using namespace ErrorCode;
67
68
namespace {
69
70
constexpr size_t MEBIBYTE = 1024 * 1024;
71
72
0
bool is_compressed_file_scan(const TPipelineFragmentParams& params) {
73
0
    if (!params.__isset.file_scan_params) {
74
0
        return false;
75
0
    }
76
0
    return std::ranges::any_of(params.file_scan_params, [](const auto& file_scan_param) {
77
0
        const auto& file_scan_params = file_scan_param.second;
78
0
        TFileCompressType::type compress_type = file_scan_params.__isset.compress_type
79
0
                                                        ? file_scan_params.compress_type
80
0
                                                        : TFileCompressType::UNKNOWN;
81
0
        TFileFormatType::type format_type = file_scan_params.__isset.format_type
82
0
                                                    ? file_scan_params.format_type
83
0
                                                    : TFileFormatType::FORMAT_UNKNOWN;
84
0
        return LoadUtil::is_compressed_load(compress_type, format_type);
85
0
    });
86
0
}
87
88
} // namespace
89
90
DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(http_stream_requests_total, MetricUnit::REQUESTS);
91
DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(http_stream_duration_ms, MetricUnit::MILLISECONDS);
92
DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(http_stream_current_processing, MetricUnit::REQUESTS);
93
94
HttpStreamAction::HttpStreamAction(ExecEnv* exec_env)
95
3
        : HttpHandlerWithAuth(exec_env, TPrivilegeHier::GLOBAL, TPrivilegeType::LOAD) {
96
    // Use LOAD privilege type: requires LOAD permission
97
    // Note: _exec_env is set by parent class HttpHandlerWithAuth
98
3
    _http_stream_entity =
99
3
            DorisMetrics::instance()->metric_registry()->register_entity("http_stream");
100
3
    INT_COUNTER_METRIC_REGISTER(_http_stream_entity, http_stream_requests_total);
101
3
    INT_COUNTER_METRIC_REGISTER(_http_stream_entity, http_stream_duration_ms);
102
3
    INT_GAUGE_METRIC_REGISTER(_http_stream_entity, http_stream_current_processing);
103
3
}
104
105
3
HttpStreamAction::~HttpStreamAction() {
106
3
    DorisMetrics::instance()->metric_registry()->deregister_entity(_http_stream_entity);
107
3
}
108
109
0
void HttpStreamAction::handle(HttpRequest* req) {
110
0
    std::shared_ptr<StreamLoadContext> ctx =
111
0
            std::static_pointer_cast<StreamLoadContext>(req->handler_ctx());
112
0
    if (ctx == nullptr) {
113
0
        return;
114
0
    }
115
116
    // status already set to fail
117
0
    if (ctx->status.ok()) {
118
0
        ctx->status = _handle(req, ctx);
119
0
        if (!ctx->status.ok() && !ctx->status.is<PUBLISH_TIMEOUT>()) {
120
0
            LOG(WARNING) << "handle streaming load failed, id=" << ctx->id
121
0
                         << ", errmsg=" << ctx->status;
122
0
        }
123
0
    }
124
0
    ctx->load_cost_millis = UnixMillis() - ctx->start_millis;
125
126
0
    if (!ctx->status.ok() && !ctx->status.is<PUBLISH_TIMEOUT>()) {
127
0
        if (ctx->body_sink != nullptr) {
128
0
            ctx->body_sink->cancel(ctx->status.to_string());
129
0
        }
130
0
    }
131
132
0
    if (!ctx->status.ok()) {
133
0
        auto str = std::string(ctx->to_json());
134
        // add new line at end
135
0
        str = str + '\n';
136
0
        HttpChannel::send_reply(req, str);
137
0
        return;
138
0
    }
139
0
    auto str = std::string(ctx->to_json());
140
    // add new line at end
141
0
    str = str + '\n';
142
0
    HttpChannel::send_reply(req, str);
143
0
    if (config::enable_stream_load_record || config::enable_stream_load_record_to_audit_log_table) {
144
0
        if (req->header(HTTP_SKIP_RECORD_TO_AUDIT_LOG_TABLE).empty()) {
145
0
            str = ctx->prepare_stream_load_record(str);
146
0
            _save_stream_load_record(ctx, str);
147
0
        }
148
0
    }
149
    // update statistics
150
0
    http_stream_requests_total->increment(1);
151
0
    http_stream_duration_ms->increment(ctx->load_cost_millis);
152
0
}
153
154
0
Status HttpStreamAction::_handle(HttpRequest* http_req, std::shared_ptr<StreamLoadContext> ctx) {
155
0
    if (ctx->body_bytes > 0 && ctx->receive_bytes != ctx->body_bytes) {
156
0
        LOG(WARNING) << "recevie body don't equal with body bytes, body_bytes=" << ctx->body_bytes
157
0
                     << ", receive_bytes=" << ctx->receive_bytes << ", id=" << ctx->id;
158
0
        return Status::Error<ErrorCode::NETWORK_ERROR>("receive body don't equal with body bytes");
159
0
    }
160
0
    RETURN_IF_ERROR(ctx->body_sink->finish());
161
162
    // wait stream load finish
163
0
    RETURN_IF_ERROR(ctx->load_status_future.get());
164
165
0
    if (ctx->group_commit) {
166
0
        LOG(INFO) << "skip commit because this is group commit, pipe_id=" << ctx->id.to_string();
167
0
        return Status::OK();
168
0
    }
169
170
0
    if (ctx->two_phase_commit) {
171
0
        int64_t pre_commit_start_time = MonotonicNanos();
172
0
        RETURN_IF_ERROR(_exec_env->stream_load_executor()->pre_commit_txn(ctx.get()));
173
0
        ctx->pre_commit_txn_cost_nanos = MonotonicNanos() - pre_commit_start_time;
174
0
    } else {
175
        // If put file success we need commit this load
176
0
        int64_t commit_and_publish_start_time = MonotonicNanos();
177
0
        RETURN_IF_ERROR(_exec_env->stream_load_executor()->commit_txn(ctx.get()));
178
0
        ctx->commit_and_publish_txn_cost_nanos = MonotonicNanos() - commit_and_publish_start_time;
179
0
    }
180
0
    return Status::OK();
181
0
}
182
183
0
int HttpStreamAction::on_header(HttpRequest* req) {
184
    // Call parent's auth check first
185
0
    int ret = HttpHandlerWithAuth::on_header(req);
186
0
    if (ret != 0) {
187
0
        return ret; // Auth failed, return error
188
0
    }
189
190
0
    http_stream_current_processing->increment(1);
191
192
0
    std::shared_ptr<StreamLoadContext> ctx = std::make_shared<StreamLoadContext>(_exec_env);
193
0
    req->set_handler_ctx(ctx);
194
195
0
    ctx->load_type = TLoadType::MANUL_LOAD;
196
0
    ctx->load_src_type = TLoadSourceType::RAW;
197
0
    ctx->two_phase_commit = req->header(HTTP_TWO_PHASE_COMMIT) == "true";
198
0
    Status st = _handle_group_commit(req, ctx);
199
200
0
    LOG(INFO) << "new income streaming load request." << ctx->brief()
201
0
              << " sql : " << req->header(HTTP_SQL) << ", group_commit=" << ctx->group_commit;
202
0
    if (st.ok()) {
203
0
        st = _on_header(req, ctx);
204
0
    }
205
0
    if (!st.ok()) {
206
0
        ctx->status = std::move(st);
207
0
        if (ctx->body_sink != nullptr) {
208
0
            ctx->body_sink->cancel(ctx->status.to_string());
209
0
        }
210
0
        auto str = ctx->to_json();
211
        // add new line at end
212
0
        str = str + '\n';
213
0
        HttpChannel::send_reply(req, str);
214
0
        if (config::enable_stream_load_record ||
215
0
            config::enable_stream_load_record_to_audit_log_table) {
216
0
            if (req->header(HTTP_SKIP_RECORD_TO_AUDIT_LOG_TABLE).empty()) {
217
0
                str = ctx->prepare_stream_load_record(str);
218
0
                _save_stream_load_record(ctx, str);
219
0
            }
220
0
        }
221
0
        return -1;
222
0
    }
223
0
    return 0;
224
0
}
225
226
1
Status HttpStreamAction::_on_header(HttpRequest* http_req, std::shared_ptr<StreamLoadContext> ctx) {
227
    // auth information
228
1
    if (!parse_basic_auth(*http_req, &ctx->auth)) {
229
0
        LOG(WARNING) << "parse basic authorization failed." << ctx->brief();
230
0
        return Status::NotAuthorized("no valid Basic authorization");
231
0
    }
232
233
    // TODO(zs) : need Need to request an FE to obtain information such as format
234
    // check content length
235
1
    ctx->body_bytes = 0;
236
1
    const auto csv_max_body_mb = config::streaming_load_max_mb;
237
1
    size_t csv_max_body_bytes = csv_max_body_mb * MEBIBYTE;
238
1
    if (!http_req->header(HttpHeaders::CONTENT_LENGTH).empty()) {
239
1
        try {
240
1
            ctx->body_bytes = std::stol(http_req->header(HttpHeaders::CONTENT_LENGTH));
241
1
        } catch (const std::exception& e) {
242
0
            return Status::InvalidArgument("invalid HTTP header CONTENT_LENGTH={}: {}",
243
0
                                           http_req->header(HttpHeaders::CONTENT_LENGTH), e.what());
244
0
        }
245
        // csv max body size
246
1
        if (ctx->body_bytes > csv_max_body_bytes) {
247
1
            LOG(WARNING) << "body exceed max size." << ctx->brief();
248
1
            return Status::Error<ErrorCode::EXCEEDED_LIMIT>(
249
1
                    "body size {} bytes ({:.2f} MiB) exceeds the limit of {} bytes ({} MiB) set "
250
1
                    "by BE config `streaming_load_max_mb`. Increase it if you are sure this load "
251
1
                    "is reasonable",
252
1
                    ctx->body_bytes, static_cast<double>(ctx->body_bytes) / MEBIBYTE,
253
1
                    csv_max_body_bytes, csv_max_body_mb);
254
1
        }
255
1
    }
256
257
0
    auto pipe = std::make_shared<io::StreamLoadPipe>(
258
0
            io::kMaxPipeBufferedBytes /* max_buffered_bytes */, 64 * 1024 /* min_chunk_size */,
259
0
            ctx->body_bytes /* total_length */);
260
0
    ctx->body_sink = pipe;
261
0
    ctx->pipe = pipe;
262
263
0
    RETURN_IF_ERROR(_exec_env->new_load_stream_mgr()->put(ctx->id, ctx));
264
265
    // Here, transactions are set from fe's NativeInsertStmt.
266
    // TODO(zs) : How to support two_phase_commit
267
268
0
    return Status::OK();
269
0
}
270
271
0
void HttpStreamAction::on_chunk_data(HttpRequest* req) {
272
0
    std::shared_ptr<StreamLoadContext> ctx =
273
0
            std::static_pointer_cast<StreamLoadContext>(req->handler_ctx());
274
0
    if (ctx == nullptr || !ctx->status.ok()) {
275
0
        return;
276
0
    }
277
0
    if (!req->header(HTTP_WAL_ID_KY).empty()) {
278
0
        ctx->wal_id = std::stoll(req->header(HTTP_WAL_ID_KY));
279
0
    }
280
0
    struct evhttp_request* ev_req = req->get_evhttp_request();
281
0
    auto evbuf = evhttp_request_get_input_buffer(ev_req);
282
283
    // In HttpStreamAction::on_chunk_data
284
    //      -> process_put
285
    //      -> StreamLoadExecutor::execute_plan_fragment
286
    //      -> exec_plan_fragment
287
    // , SCOPED_ATTACH_TASK will be called.
288
0
    SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(ExecEnv::GetInstance()->stream_load_pipe_tracker());
289
290
0
    int64_t start_read_data_time = MonotonicNanos();
291
0
    Status st = ctx->allocate_schema_buffer();
292
0
    if (!st.ok()) {
293
0
        ctx->status = st;
294
0
        return;
295
0
    }
296
0
    while (evbuffer_get_length(evbuf) > 0) {
297
0
        ByteBufferPtr bb;
298
0
        st = ByteBuffer::allocate(128 * 1024, &bb);
299
0
        if (!st.ok()) {
300
0
            ctx->status = st;
301
0
            return;
302
0
        }
303
0
        auto remove_bytes = evbuffer_remove(evbuf, bb->ptr, bb->capacity);
304
0
        bb->pos = remove_bytes;
305
0
        bb->flip();
306
0
        st = ctx->body_sink->append(bb);
307
        // schema_buffer stores 1M of data for parsing column information
308
        // need to determine whether to cache for the first time
309
0
        if (ctx->is_read_schema) {
310
0
            if (ctx->schema_buffer()->pos + remove_bytes < config::stream_tvf_buffer_size) {
311
0
                ctx->schema_buffer()->put_bytes(bb->ptr, remove_bytes);
312
0
            } else {
313
0
                LOG(INFO) << "use a portion of data to request fe to obtain column information";
314
0
                ctx->is_read_schema = false;
315
0
                ctx->status = process_put(req, ctx);
316
0
            }
317
0
        }
318
0
        if (!st.ok()) {
319
0
            LOG(WARNING) << "append body content failed. errmsg=" << st << ", " << ctx->brief();
320
0
            ctx->status = st;
321
0
            return;
322
0
        }
323
0
        ctx->receive_bytes += remove_bytes;
324
0
    }
325
    // after all the data has been read and it has not reached 1M, it will execute here
326
0
    if (ctx->is_read_schema) {
327
0
        LOG(INFO) << "after all the data has been read and it has not reached 1M, it will execute "
328
0
                  << "here";
329
0
        ctx->is_read_schema = false;
330
0
        ctx->status = process_put(req, ctx);
331
0
    }
332
0
    ctx->read_data_cost_nanos += (MonotonicNanos() - start_read_data_time);
333
0
}
334
335
0
void HttpStreamAction::free_handler_ctx(std::shared_ptr<void> param) {
336
0
    std::shared_ptr<StreamLoadContext> ctx = std::static_pointer_cast<StreamLoadContext>(param);
337
0
    if (ctx == nullptr) {
338
0
        return;
339
0
    }
340
    // sender is gone, make receiver know it
341
0
    if (ctx->body_sink != nullptr) {
342
0
        ctx->body_sink->cancel("sender is gone");
343
0
    }
344
    // remove stream load context from stream load manager and the resource will be released
345
0
    ctx->exec_env()->new_load_stream_mgr()->remove(ctx->id);
346
0
    http_stream_current_processing->increment(-1);
347
0
}
348
349
Status HttpStreamAction::process_put(HttpRequest* http_req,
350
0
                                     std::shared_ptr<StreamLoadContext> ctx) {
351
0
    TStreamLoadPutRequest request;
352
0
    if (http_req != nullptr) {
353
0
        request.__set_load_sql(http_req->header(HTTP_SQL));
354
0
        if (!http_req->header(HTTP_MEMTABLE_ON_SINKNODE).empty()) {
355
0
            bool value = iequal(http_req->header(HTTP_MEMTABLE_ON_SINKNODE), "true");
356
0
            request.__set_memtable_on_sink_node(value);
357
0
        }
358
0
    } else {
359
0
        request.__set_token(ctx->auth.token);
360
0
        request.__set_load_sql(ctx->sql_str);
361
0
        ctx->auth.token = "";
362
0
    }
363
0
    set_request_auth(&request, ctx->auth);
364
0
    request.__set_loadId(ctx->id.to_thrift());
365
0
    request.__set_label(ctx->label);
366
0
    if (ctx->group_commit) {
367
0
        if (!http_req->header(HTTP_GROUP_COMMIT).empty()) {
368
0
            request.__set_group_commit_mode(http_req->header(HTTP_GROUP_COMMIT));
369
0
        } else {
370
            // used for wait_internal_group_commit_finish
371
0
            request.__set_group_commit_mode("sync_mode");
372
0
        }
373
0
    }
374
0
    if (_exec_env->cluster_info()->backend_id != 0) {
375
0
        request.__set_backend_id(_exec_env->cluster_info()->backend_id);
376
0
    } else {
377
0
        LOG(WARNING) << "_exec_env->cluster_info not set backend_id";
378
0
    }
379
0
    if (ctx->wal_id > 0) {
380
0
        request.__set_partial_update(false);
381
0
    }
382
383
    // plan this load
384
0
    TNetworkAddress master_addr = _exec_env->cluster_info()->master_fe_addr;
385
0
    int64_t stream_load_put_start_time = MonotonicNanos();
386
0
    RETURN_IF_ERROR(ThriftRpcHelper::rpc<FrontendServiceClient>(
387
0
            master_addr.hostname, master_addr.port,
388
0
            [&request, ctx](FrontendServiceConnection& client) {
389
0
                client->streamLoadPut(ctx->put_result, request);
390
0
            }));
391
0
    ctx->put_result.pipeline_params.query_options.__set_enable_strict_cast(false);
392
0
    ctx->stream_load_put_cost_nanos = MonotonicNanos() - stream_load_put_start_time;
393
0
    Status plan_status(Status::create(ctx->put_result.status));
394
0
    if (!plan_status.ok()) {
395
0
        LOG(WARNING) << "plan streaming load failed. errmsg=" << plan_status << ctx->brief();
396
0
        return plan_status;
397
0
    }
398
0
    if (config::is_cloud_mode() && ctx->two_phase_commit && ctx->is_mow_table()) {
399
0
        return Status::NotSupported("http stream 2pc is unsupported for mow table");
400
0
    }
401
0
    ctx->db = ctx->put_result.pipeline_params.db_name;
402
0
    ctx->table = ctx->put_result.pipeline_params.table_name;
403
0
    ctx->txn_id = ctx->put_result.pipeline_params.txn_conf.txn_id;
404
0
    ctx->label = ctx->put_result.pipeline_params.import_label;
405
0
    ctx->put_result.pipeline_params.__set_wal_id(ctx->wal_id);
406
0
    if (http_req != nullptr && http_req->header(HTTP_GROUP_COMMIT) == "async_mode") {
407
        // FIXME find a way to avoid chunked stream load write large WALs
408
0
        size_t content_length = 0;
409
0
        if (!http_req->header(HttpHeaders::CONTENT_LENGTH).empty()) {
410
0
            try {
411
0
                content_length = std::stol(http_req->header(HttpHeaders::CONTENT_LENGTH));
412
0
            } catch (const std::exception& e) {
413
0
                return Status::InvalidArgument("invalid HTTP header CONTENT_LENGTH={}: {}",
414
0
                                               http_req->header(HttpHeaders::CONTENT_LENGTH),
415
0
                                               e.what());
416
0
            }
417
0
            if (is_compressed_file_scan(ctx->put_result.pipeline_params)) {
418
0
                content_length *= 3;
419
0
            }
420
0
        }
421
0
        ctx->put_result.pipeline_params.__set_content_length(content_length);
422
0
    }
423
0
    TPipelineFragmentParamsList mocked;
424
0
    return _exec_env->stream_load_executor()->execute_plan_fragment(ctx, mocked);
425
0
}
426
427
void HttpStreamAction::_save_stream_load_record(std::shared_ptr<StreamLoadContext> ctx,
428
0
                                                const std::string& str) {
429
0
    std::shared_ptr<StreamLoadRecorder> stream_load_recorder =
430
0
            ExecEnv::GetInstance()->storage_engine().get_stream_load_recorder();
431
432
0
    if (stream_load_recorder != nullptr) {
433
0
        std::string key =
434
0
                std::to_string(ctx->start_millis + ctx->load_cost_millis) + "_" + ctx->label;
435
0
        auto st = stream_load_recorder->put(key, str);
436
0
        if (st.ok()) {
437
0
            LOG(INFO) << "put stream_load_record rocksdb successfully. label: " << ctx->label
438
0
                      << ", key: " << key;
439
0
        }
440
0
    } else {
441
0
        LOG(WARNING) << "put stream_load_record rocksdb failed. stream_load_recorder is null.";
442
0
    }
443
0
}
444
445
Status HttpStreamAction::_handle_group_commit(HttpRequest* req,
446
0
                                              std::shared_ptr<StreamLoadContext> ctx) {
447
0
    std::string group_commit_mode = req->header(HTTP_GROUP_COMMIT);
448
0
    if (!group_commit_mode.empty() && !iequal(group_commit_mode, "sync_mode") &&
449
0
        !iequal(group_commit_mode, "async_mode") && !iequal(group_commit_mode, "off_mode")) {
450
0
        return Status::InvalidArgument(
451
0
                "group_commit can only be [async_mode, sync_mode, off_mode]");
452
0
    }
453
0
    if (config::wait_internal_group_commit_finish) {
454
0
        group_commit_mode = "sync_mode";
455
0
    }
456
0
    int64_t content_length = req->header(HttpHeaders::CONTENT_LENGTH).empty()
457
0
                                     ? 0
458
0
                                     : std::stoll(req->header(HttpHeaders::CONTENT_LENGTH));
459
0
    if (content_length < 0) {
460
0
        std::stringstream ss;
461
0
        ss << "This http load content length <0 (" << content_length
462
0
           << "), please check your content length.";
463
0
        LOG(WARNING) << ss.str();
464
0
        return Status::InvalidArgument(ss.str());
465
0
    }
466
    // allow chunked stream load in flink
467
0
    auto is_chunk =
468
0
            !req->header(HttpHeaders::TRANSFER_ENCODING).empty() &&
469
0
            req->header(HttpHeaders::TRANSFER_ENCODING).find("chunked") != std::string::npos;
470
0
    if (group_commit_mode.empty() || iequal(group_commit_mode, "off_mode") ||
471
0
        (content_length == 0 && !is_chunk)) {
472
        // off_mode and empty
473
0
        ctx->group_commit = false;
474
0
        return Status::OK();
475
0
    }
476
0
    if (is_chunk) {
477
0
        ctx->label = "";
478
0
    }
479
480
0
    auto partial_columns = !req->header(HTTP_PARTIAL_COLUMNS).empty() &&
481
0
                           iequal(req->header(HTTP_PARTIAL_COLUMNS), "true");
482
0
    auto temp_partitions = !req->header(HTTP_TEMP_PARTITIONS).empty();
483
0
    auto partitions = !req->header(HTTP_PARTITIONS).empty();
484
0
    if (!partial_columns && !partitions && !temp_partitions && !ctx->two_phase_commit) {
485
0
        if (!config::wait_internal_group_commit_finish && !ctx->label.empty()) {
486
0
            return Status::InvalidArgument("label and group_commit can't be set at the same time");
487
0
        }
488
0
        ctx->group_commit = true;
489
0
        if (iequal(group_commit_mode, "async_mode")) {
490
0
            if (!load_size_smaller_than_wal_limit(content_length)) {
491
0
                std::stringstream ss;
492
0
                ss << "There is no space for group commit http load async WAL. This http load "
493
0
                      "size is "
494
0
                   << content_length << ". WAL dir info: "
495
0
                   << ExecEnv::GetInstance()->wal_mgr()->get_wal_dirs_info_string();
496
0
                LOG(WARNING) << ss.str();
497
0
                return Status::Error<EXCEEDED_LIMIT>(ss.str());
498
0
            }
499
0
        }
500
0
    }
501
0
    return Status::OK();
502
0
}
503
504
} // namespace doris