Coverage Report

Created: 2026-03-16 19:58

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/service/http/action/shrink_mem_action.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/shrink_mem_action.h"
19
20
#include <fmt/core.h>
21
22
#include "runtime/exec_env.h"
23
#include "runtime/memory/memory_reclamation.h"
24
#include "service/http/http_channel.h"
25
#include "service/http/http_request.h"
26
#include "util/brpc_client_cache.h"
27
#include "util/mem_info.h"
28
#include "util/string_util.h"
29
30
namespace doris {
31
0
void ShrinkMemAction::handle(HttpRequest* req) {
32
0
    LOG(INFO) << "begin shrink memory";
33
    /* this interface might be ready for cloud in the near future
34
     * int freed_mem = 0;
35
     * doris::MemInfo::process_cache_gc(&freed_mem); */
36
0
    MemoryReclamation::revoke_process_memory("ShrinkMemAction");
37
0
    LOG(INFO) << "shrink memory triggered, using Process GC Free Memory";
38
0
    HttpChannel::send_reply(req, HttpStatus::OK, "shrinking");
39
40
0
    ExecEnv::GetInstance()->set_is_upgrading();
41
0
}
42
43
} // namespace doris