Coverage Report

Created: 2026-03-15 01:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/service/http/action/stream_load.h
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
#pragma once
19
20
#include <memory>
21
#include <mutex>
22
#include <string>
23
24
#include "common/metrics/metrics.h"
25
#include "service/http/http_handler.h"
26
27
namespace doris {
28
29
class ExecEnv;
30
class Status;
31
class StreamLoadContext;
32
class HttpRequest;
33
34
class StreamLoadAction : public HttpHandler {
35
public:
36
    StreamLoadAction(ExecEnv* exec_env);
37
    ~StreamLoadAction() override;
38
39
    void handle(HttpRequest* req) override;
40
41
0
    bool request_will_be_read_progressively() override { return true; }
42
43
    int on_header(HttpRequest* req) override;
44
45
    void on_chunk_data(HttpRequest* req) override;
46
    void free_handler_ctx(std::shared_ptr<void> ctx) override;
47
48
private:
49
    Status _on_header(HttpRequest* http_req, std::shared_ptr<StreamLoadContext> ctx);
50
    Status _handle(std::shared_ptr<StreamLoadContext> ctx, HttpRequest* req);
51
    Status _data_saved_path(HttpRequest* req, std::string* file_path, int64_t file_bytes);
52
    Status _process_put(HttpRequest* http_req, std::shared_ptr<StreamLoadContext> ctx);
53
    void _save_stream_load_record(std::shared_ptr<StreamLoadContext> ctx, const std::string& str);
54
    Status _handle_group_commit(HttpRequest* http_req, std::shared_ptr<StreamLoadContext> ctx);
55
    void _on_finish(std::shared_ptr<StreamLoadContext> ctx, HttpRequest* req);
56
    void _send_reply(std::shared_ptr<StreamLoadContext> ctx, HttpRequest* req);
57
58
private:
59
    ExecEnv* _exec_env;
60
61
    std::shared_ptr<MetricEntity> _stream_load_entity;
62
    IntCounter* streaming_load_requests_total;
63
    IntCounter* streaming_load_duration_ms;
64
    IntGauge* streaming_load_current_processing;
65
};
66
67
} // namespace doris