Coverage Report

Created: 2024-11-21 16:04

/root/doris/be/src/agent/agent_server.h
Line
Count
Source (jump to first uncovered line)
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 <butil/macros.h>
21
22
#include <memory>
23
#include <string>
24
#include <vector>
25
26
namespace doris {
27
28
class TaskWorkerPool;
29
class PriorTaskWorkerPool;
30
class ReportWorker;
31
class TopicSubscriber;
32
class ExecEnv;
33
class TAgentPublishRequest;
34
class TAgentResult;
35
class TAgentTaskRequest;
36
class TMasterInfo;
37
class TSnapshotRequest;
38
39
// Each method corresponds to one RPC from FE Master, see BackendService.
40
class AgentServer {
41
public:
42
    explicit AgentServer(ExecEnv* exec_env, const TMasterInfo& master_info);
43
    ~AgentServer();
44
45
    // Receive agent task from FE master
46
    void submit_tasks(TAgentResult& agent_result, const std::vector<TAgentTaskRequest>& tasks);
47
48
    // TODO(lingbin): make the agent_result to be a pointer, because it will be modified.
49
    void make_snapshot(TAgentResult& agent_result, const TSnapshotRequest& snapshot_request);
50
    void release_snapshot(TAgentResult& agent_result, const std::string& snapshot_path);
51
52
    // Deprecated
53
    // TODO(lingbin): This method is deprecated, should be removed later.
54
    // [[deprecated]]
55
    void publish_cluster_state(TAgentResult& agent_result, const TAgentPublishRequest& request);
56
57
0
    TopicSubscriber* get_topic_subscriber() { return _topic_subscriber.get(); }
58
59
private:
60
    void start_workers(ExecEnv* exec_env);
61
62
    DISALLOW_COPY_AND_ASSIGN(AgentServer);
63
64
    // Reference to the ExecEnv::_master_info
65
    const TMasterInfo& _master_info;
66
67
    std::unique_ptr<TaskWorkerPool> _create_tablet_workers;
68
    std::unique_ptr<TaskWorkerPool> _drop_tablet_workers;
69
    std::unique_ptr<PriorTaskWorkerPool> _push_load_workers;
70
    std::unique_ptr<TaskWorkerPool> _publish_version_workers;
71
    std::unique_ptr<TaskWorkerPool> _clear_transaction_task_workers;
72
    std::unique_ptr<TaskWorkerPool> _push_delete_workers;
73
    std::unique_ptr<TaskWorkerPool> _alter_tablet_workers;
74
    std::unique_ptr<TaskWorkerPool> _alter_inverted_index_workers;
75
    std::unique_ptr<TaskWorkerPool> _push_cooldown_conf_workers;
76
    std::unique_ptr<TaskWorkerPool> _clone_workers;
77
    std::unique_ptr<TaskWorkerPool> _storage_medium_migrate_workers;
78
    std::unique_ptr<TaskWorkerPool> _check_consistency_workers;
79
80
    // These 3 worker-pool do not accept tasks from FE.
81
    // It is self triggered periodically and reports to Fe master
82
    std::unique_ptr<ReportWorker> _report_task_workers;
83
    std::unique_ptr<ReportWorker> _report_disk_state_workers;
84
    std::unique_ptr<ReportWorker> _report_tablet_workers;
85
86
    std::unique_ptr<TaskWorkerPool> _upload_workers;
87
    std::unique_ptr<TaskWorkerPool> _download_workers;
88
    std::unique_ptr<TaskWorkerPool> _make_snapshot_workers;
89
    std::unique_ptr<TaskWorkerPool> _release_snapshot_workers;
90
    std::unique_ptr<TaskWorkerPool> _move_dir_workers;
91
    std::unique_ptr<TaskWorkerPool> _recover_tablet_workers;
92
    std::unique_ptr<TaskWorkerPool> _update_tablet_meta_info_workers;
93
94
    std::unique_ptr<TaskWorkerPool> _submit_table_compaction_workers;
95
96
    std::unique_ptr<TaskWorkerPool> _push_storage_policy_workers;
97
    std::unique_ptr<TopicSubscriber> _topic_subscriber;
98
    std::unique_ptr<TaskWorkerPool> _gc_binlog_workers;
99
    std::unique_ptr<TaskWorkerPool> _clean_trash_workers;
100
    std::unique_ptr<TaskWorkerPool> _update_visible_version_workers;
101
};
102
103
} // end namespace doris