Coverage Report

Created: 2026-03-16 14:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/cloud/cloud_compaction_action.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 <stdint.h>
21
22
#include <string>
23
24
#include "cloud/cloud_storage_engine.h"
25
#include "common/status.h"
26
#include "service/http/action/compaction_action.h"
27
#include "service/http/http_handler_with_auth.h"
28
#include "storage/tablet/tablet.h"
29
30
namespace doris {
31
class HttpRequest;
32
33
class ExecEnv;
34
35
/*
36
enum class CompactionActionType {
37
    SHOW_INFO = 1,
38
    RUN_COMPACTION = 2,
39
    RUN_COMPACTION_STATUS = 3,
40
};
41
*/
42
43
/*
44
const std::string PARAM_COMPACTION_TYPE = "compact_type";
45
const std::string PARAM_COMPACTION_BASE = "base";
46
const std::string PARAM_COMPACTION_CUMULATIVE = "cumulative";
47
const std::string PARAM_COMPACTION_FULL = "full";
48
*/
49
50
/// This action is used for viewing the compaction status.
51
/// See compaction-action.md for details.
52
class CloudCompactionAction : public HttpHandlerWithAuth {
53
public:
54
    CloudCompactionAction(CompactionActionType ctype, ExecEnv* exec_env, CloudStorageEngine& engine,
55
                          TPrivilegeHier::type hier, TPrivilegeType::type ptype);
56
57
0
    ~CloudCompactionAction() override = default;
58
59
    void handle(HttpRequest* req) override;
60
61
private:
62
    Status _handle_show_compaction(HttpRequest* req, std::string* json_result);
63
64
    /// execute compaction request to run compaction task
65
    /// param compact_type in req to distinguish the task type, base or cumulative
66
    Status _handle_run_compaction(HttpRequest* req, std::string* json_result);
67
68
    /// fetch compaction running status
69
    Status _handle_run_status_compaction(HttpRequest* req, std::string* json_result);
70
71
private:
72
    CloudStorageEngine& _engine;
73
    CompactionActionType _compaction_type;
74
};
75
76
} // end namespace doris