This is an automated email from the ASF dual-hosted git repository.
lihaopeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 6b9cb49 [Refactor] remove plugin folder in be since it is useless and
it need fPIC tag to build and we will remove all fPIC tag in the future (#8008)
6b9cb49 is described below
commit 6b9cb49779940f3daf68ceadbdced1d1efa159cb
Author: yiguolei <[email protected]>
AuthorDate: Sat Feb 12 12:28:14 2022 +0800
[Refactor] remove plugin folder in be since it is useless and it need fPIC
tag to build and we will remove all fPIC tag in the future (#8008)
---
be/CMakeLists.txt | 22 -----
be/src/common/config.h | 2 -
be/src/plugin/CMakeLists.txt | 28 ------
be/src/plugin/plugin.h | 82 ----------------
be/src/plugin/plugin_loader.cpp | 197 ---------------------------------------
be/src/plugin/plugin_loader.h | 108 ---------------------
be/src/plugin/plugin_mgr.cpp | 165 --------------------------------
be/src/plugin/plugin_mgr.h | 64 -------------
be/src/plugin/plugin_zip.cpp | 132 --------------------------
be/src/plugin/plugin_zip.h | 43 ---------
be/src/runtime/exec_env.h | 4 -
be/src/runtime/exec_env_init.cpp | 2 -
12 files changed, 849 deletions(-)
diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt
index 2d50c67..377ddd6 100644
--- a/be/CMakeLists.txt
+++ b/be/CMakeLists.txt
@@ -586,7 +586,6 @@ set(DORIS_LINK_LIBS
Webserver
Geo
Vec
- Plugin
${WL_END_GROUP}
)
if (${MAKE_TEST} STREQUAL "ON")
@@ -775,7 +774,6 @@ if (BUILD_META_TOOL AND BUILD_META_TOOL STREQUAL "ON")
endif()
add_subdirectory(${SRC_DIR}/util)
-add_subdirectory(${SRC_DIR}/plugin)
add_subdirectory(${SRC_DIR}/vec)
# Utility CMake function to make specifying tests and benchmarks less verbose
@@ -797,24 +795,6 @@ FUNCTION(ADD_BE_TEST TEST_NAME)
ADD_TEST(${TEST_FILE_NAME} "${BUILD_OUTPUT_ROOT_DIRECTORY}/${TEST_NAME}")
ENDFUNCTION()
-FUNCTION(ADD_BE_PLUGIN PLUGIN_NAME)
- set(BUILD_OUTPUT_ROOT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/")
-
- get_filename_component(DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
- get_filename_component(PLUGIN_DIR_NAME ${PLUGIN_NAME} PATH)
- get_filename_component(PLUGIN_FILE_NAME ${PLUGIN_NAME} NAME)
-
- ADD_LIBRARY(${PLUGIN_FILE_NAME} SHARED ${PLUGIN_NAME}.cpp)
-
- TARGET_LINK_LIBRARIES(${PLUGIN_FILE_NAME} ${DORIS_LINK_LIBS})
- SET_TARGET_PROPERTIES(${PLUGIN_FILE_NAME} PROPERTIES COMPILE_FLAGS
"-fno-access-control")
-
- if (NOT "${PLUGIN_DIR_NAME}" STREQUAL "")
- SET_TARGET_PROPERTIES(${PLUGIN_FILE_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}/${PLUGIN_DIR_NAME}")
- endif ()
-
-ENDFUNCTION()
-
if (${MAKE_TEST} STREQUAL "ON")
add_subdirectory(${TEST_DIR}/test_util)
add_subdirectory(${TEST_DIR}/agent)
@@ -835,8 +815,6 @@ if (${MAKE_TEST} STREQUAL "ON")
add_subdirectory(${TEST_DIR}/vec/function)
add_subdirectory(${TEST_DIR}/vec/runtime)
add_subdirectory(${TEST_DIR}/vec/aggregate_functions)
- add_subdirectory(${TEST_DIR}/plugin)
- add_subdirectory(${TEST_DIR}/plugin/example)
add_subdirectory(${TEST_DIR}/tools)
endif ()
diff --git a/be/src/common/config.h b/be/src/common/config.h
index c75d434..cc34489 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -544,8 +544,6 @@ CONF_mInt64(max_runnings_transactions_per_txn_map, "100");
// this is a an enhancement for better performance to manage tablet
CONF_Int32(tablet_map_shard_size, "1");
-CONF_String(plugin_path, "${DORIS_HOME}/plugin");
-
// txn_map_lock shard size, the value is 2^n, n=0,1,2,3,4
// this is a an enhancement for better performance to manage txn
CONF_Int32(txn_map_shard_size, "128");
diff --git a/be/src/plugin/CMakeLists.txt b/be/src/plugin/CMakeLists.txt
deleted file mode 100644
index ecc5dac..0000000
--- a/be/src/plugin/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# where to put generated libraries
-set(LIBRARY_OUTPUT_PATH "${BUILD_DIR}/src/plugin")
-
-# where to put generated binaries
-set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/src/plugin")
-
-add_library(Plugin STATIC
- plugin_loader.cpp
- plugin_mgr.cpp
- plugin_zip.cpp
- )
diff --git a/be/src/plugin/plugin.h b/be/src/plugin/plugin.h
deleted file mode 100644
index 9a31f46..0000000
--- a/be/src/plugin/plugin.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#ifndef DORIS_BE_PLUGIN_PLUGIN_H
-#define DORIS_BE_PLUGIN_PLUGIN_H
-
-namespace doris {
-
-#define PLUGIN_TYPE_AUDIT 1
-#define PLUGIN_TYPE_IMPORT 2
-#define PLUGIN_TYPE_STORAGE 3
-#define PLUGIN_TYPE_MAX 4
-
-#define PLUGIN_DEFAULT_FLAG 0UL
-#define PLUGIN_INSTALL_EARLY 1UL
-#define PLUGIN_NOT_DYNAMIC_UNINSTALL 2UL
-
-#define DORIS_PLUGIN_VERSION 001100UL
-
-/**
- * define a plugin:
- *
- * declare_plugin(PLUGIN_NAME) {
- * xx_handler,
- * init_method,
- * close_method,
- * PLUGIN_NOT_DYNAMIC_INSTALL | PLUGIN_NOT_DYNAMIC_UNINSTALL,
- * nullptr,
- * nullptr
- * } declare_plugin_end
- *
- */
-struct Plugin {
- // support by type-specific plugin
- void* handler;
-
- // invoke when plugin install
- int (*init)(void*);
-
- // invoke when plugin uninstall
- int (*close)(void*);
-
- // flag for plugin
- uint64_t flags;
-
- // use to set/get variables
- void* variable;
-
- // return the plugin's status
- void* status;
-};
-
-#define __DECLARE_PLUGIN(VERSION, PSIZE, DECLS) \
- int VERSION = DORIS_PLUGIN_VERSION; \
- int PSIZE = sizeof(struct Plugin); \
- Plugin DECLS[] = {
-// Plugin Name must be same with plugin's description file
-#define declare_plugin(NAME) \
- __DECLARE_PLUGIN(NAME##_plugin_interface_version, NAME##_sizeof_plugin,
NAME##_plugin)
-
-#define declare_plugin_end \
- , { 0, 0, 0, 0, 0, 0 } \
- } \
- ;
-
-} // namespace doris
-
-#endif //DORIS_BE_PLUGIN_PLUGIN_H
diff --git a/be/src/plugin/plugin_loader.cpp b/be/src/plugin/plugin_loader.cpp
deleted file mode 100644
index a0d0674..0000000
--- a/be/src/plugin/plugin_loader.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#include "plugin/plugin_loader.h"
-
-#include <boost/algorithm/string/predicate.hpp>
-#include <cstring>
-
-#include "env/env.h"
-#include "gutil/strings/substitute.h"
-#include "gutil/strings/util.h"
-#include "http/http_client.h"
-#include "plugin/plugin_zip.h"
-#include "util/dynamic_util.h"
-#include "util/file_utils.h"
-#include "util/md5.h"
-#include "util/time.h"
-
-namespace doris {
-
-using namespace strings;
-
-static const std::string PLUGIN_VERSION_SYMBOL = "_plugin_interface_version";
-static const std::string PLUGIN_SIZE_SYMBOL = "_sizeof_plugin";
-static const std::string PLUGIN_STRUCT_SYMBOL = "_plugin";
-
-Status PluginLoader::open_valid() {
- return Status::OK();
-}
-
-Status PluginLoader::close_valid() {
- if (_plugin.get() != nullptr && (_plugin->flags &
PLUGIN_NOT_DYNAMIC_UNINSTALL)) {
- return Status::InternalError(
- strings::Substitute("plugin $0 not allow dynamic uninstall",
_name));
- }
-
- return Status::OK();
-}
-
-Status DynamicPluginLoader::install() {
- // check already install
- std::string so_path = _install_path + "/" + _name + "/" + _so_name;
- if (!FileUtils::check_exist(so_path)) {
- // no, need download zip install
- PluginZip zip(_source);
-
- RETURN_NOT_OK_STATUS_WITH_WARN(zip.extract(_install_path, _name),
"plugin install failed");
- }
-
- // open plugin
- RETURN_NOT_OK_STATUS_WITH_WARN(open_plugin(), "plugin install failed");
-
- RETURN_NOT_OK_STATUS_WITH_WARN(open_valid(), "plugin install failed");
-
- // plugin init
- // todo: what should be send?
- if (_plugin->init != nullptr) {
- _plugin->init(&_plugin->handler);
- }
-
- return Status::OK();
-}
-
-/**
- * open & valid Plugin:
- * 1. check .so file exists
- * 2. check .so version symbol
- * 3. check .so plugin symbol
- */
-Status DynamicPluginLoader::open_plugin() {
- // check .so file
- std::string so_path = _install_path + "/" + _name + "/" + _so_name;
- if (!FileUtils::check_exist(so_path)) {
- return Status::InternalError("plugin install not found " + _so_name);
- }
-
- RETURN_IF_ERROR(dynamic_open(so_path.c_str(), &_plugin_handler));
-
- void* symbol;
- // check version symbol
- RETURN_IF_ERROR(
- dynamic_lookup(_plugin_handler, (_name +
PLUGIN_VERSION_SYMBOL).c_str(), &symbol));
-
- if (DORIS_PLUGIN_VERSION > *(int*)symbol) {
- return Status::InternalError("plugin compile version too old");
- }
-
- RETURN_IF_ERROR(dynamic_lookup(_plugin_handler, (_name +
PLUGIN_SIZE_SYMBOL).c_str(), &symbol));
-
- int plugin_size = *(int*)symbol;
- if (plugin_size != sizeof(Plugin)) {
- return Status::InternalError("plugin struct error");
- }
-
- // check Plugin declaration
- RETURN_IF_ERROR(
- dynamic_lookup(_plugin_handler, (_name +
PLUGIN_STRUCT_SYMBOL).c_str(), &symbol));
-
- Plugin* end_plugin = (Plugin*)((char*)symbol + plugin_size);
-
- if (end_plugin->handler != nullptr || end_plugin->init != nullptr ||
- end_plugin->close != nullptr) {
- return Status::InternalError("plugin struct error");
- }
-
- _plugin = std::make_shared<Plugin>();
- std::memcpy(_plugin.get(), symbol, plugin_size);
-
- return Status::OK();
-}
-
-Status DynamicPluginLoader::uninstall() {
- // close plugin
- RETURN_IF_ERROR(close_plugin());
-
- // remove plugin install path
- RETURN_IF_ERROR(FileUtils::remove_all(_install_path + "/" + _name));
-
- return Status::OK();
-}
-
-Status DynamicPluginLoader::close_plugin() {
- if (_close) {
- return Status::OK();
- }
-
- if (_plugin.get() != nullptr) {
- RETURN_IF_ERROR(close_valid());
-
- if (_plugin->close != nullptr) {
- // todo: what should be send?
- _plugin->close(&_plugin->handler);
- }
- }
-
- // builtin plugin don't need dynamic uninstall
- if (_plugin_handler != nullptr) {
- dynamic_close(_plugin_handler);
- }
-
- _close = true;
- return Status::OK();
-}
-
-BuiltinPluginLoader::BuiltinPluginLoader(const std::string& name, int type,
- const doris::Plugin* plugin)
- : PluginLoader(name, type) {
- _plugin = std::make_shared<Plugin>();
- std::memcpy(_plugin.get(), plugin, sizeof(Plugin));
-}
-
-Status BuiltinPluginLoader::install() {
- RETURN_IF_ERROR(open_valid());
- LOG(INFO) << "plugin: " << _plugin.get();
-
- if (_plugin->init != nullptr) {
- _plugin->init(&_plugin->handler);
- }
-
- return Status::OK();
-}
-
-Status BuiltinPluginLoader::uninstall() {
- if (_close) {
- return Status::OK();
- }
-
- if (_plugin.get() != nullptr) {
- RETURN_IF_ERROR(close_valid());
-
- if (_plugin->close != nullptr) {
- // todo: what should be send?
- _plugin->close(&_plugin->handler);
- }
-
- _plugin.reset();
- }
-
- _close = true;
- return Status::OK();
-}
-
-} // namespace doris
diff --git a/be/src/plugin/plugin_loader.h b/be/src/plugin/plugin_loader.h
deleted file mode 100644
index 3a37f45..0000000
--- a/be/src/plugin/plugin_loader.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#ifndef DORIS_BE_PLUGIN_PLUGIN_LOADER_H
-#define DORIS_BE_PLUGIN_PLUGIN_LOADER_H
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "common/status.h"
-#include "gen_cpp/Types_types.h"
-#include "plugin/plugin.h"
-
-namespace doris {
-
-class PluginLoader {
-public:
- PluginLoader(const std::string& name, int type) : _name(name),
_type(type), _close(false) {}
-
- virtual ~PluginLoader(){};
-
- virtual Status install() = 0;
-
- virtual Status uninstall() = 0;
-
- virtual std::shared_ptr<Plugin>& plugin() { return _plugin; };
-
- const std::string& name() { return _name; }
-
- int type() { return _type; }
-
-protected:
- virtual Status open_valid();
-
- virtual Status close_valid();
-
-protected:
- std::string _name;
-
- int _type;
-
- std::shared_ptr<Plugin> _plugin;
-
- bool _close;
-};
-
-class DynamicPluginLoader : public PluginLoader {
-public:
- DynamicPluginLoader(const std::string& name, int type, const std::string&
source,
- const std::string& so_name, const std::string&
install_path)
- : PluginLoader(name, type),
- _source(source),
- _so_name(so_name),
- _install_path(install_path),
- _plugin_handler(nullptr){};
-
- virtual ~DynamicPluginLoader() {
- // just close plugin, but don't clean install path (maybe other plugin
has used)
- WARN_IF_ERROR(close_plugin(), "close plugin failed.");
- };
-
- virtual Status install();
-
- virtual Status uninstall();
-
-private:
- Status open_plugin();
-
- Status close_plugin();
-
-private:
- std::string _source;
-
- std::string _so_name;
-
- std::string _install_path;
-
- void* _plugin_handler;
-};
-
-class BuiltinPluginLoader : public PluginLoader {
-public:
- BuiltinPluginLoader(const std::string& name, int type, const Plugin*
plugin);
-
- virtual ~BuiltinPluginLoader() { WARN_IF_ERROR(uninstall(), "close plugin
failed."); }
-
- virtual Status install();
-
- virtual Status uninstall();
-};
-
-} // namespace doris
-#endif //DORIS_BE_PLUGIN_PLUGIN_LOADER_H
diff --git a/be/src/plugin/plugin_mgr.cpp b/be/src/plugin/plugin_mgr.cpp
deleted file mode 100644
index 5cfee90..0000000
--- a/be/src/plugin/plugin_mgr.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#include "plugin/plugin_mgr.h"
-
-#include "common/config.h"
-#include "gutil/strings/substitute.h"
-
-namespace doris {
-
-using namespace strings;
-
-#define PLUGIN_TYPE_CHECK(_type)
\
- {
\
- if (_type >= PLUGIN_TYPE_MAX) {
\
- return Status::InvalidArgument(strings::Substitute("error plugin
type: $0", _type)); \
- }
\
- }
-
-Status PluginMgr::install_plugin(const TPluginMetaInfo& info) {
- {
- std::lock_guard<std::mutex> l(_lock);
- auto iter = _plugins[info.type].find(info.name);
-
- if (iter != _plugins[info.type].end()) {
- return Status::AlreadyExist("plugin " + info.name + " is already
installed");
- }
- }
-
- DCHECK(info.__isset.so_name);
- DCHECK(info.__isset.source);
-
- std::unique_ptr<PluginLoader> loader = std::unique_ptr<PluginLoader>(new
DynamicPluginLoader(
- info.name, info.type, info.source, info.so_name,
config::plugin_path));
-
- Status st = loader->install();
-
- if (!st.ok() && !st.is_already_exist()) {
- RETURN_IF_ERROR(loader->uninstall());
- return st;
- }
-
- {
- std::lock_guard<std::mutex> l(_lock);
- auto iter = _plugins[info.type].find(info.name);
-
- if (iter != _plugins[info.type].end()) {
- return Status::AlreadyExist("plugin " + info.name + " is already
installed");
- } else {
- _plugins[info.type][info.name] = std::move(loader);
- };
- }
-
- return Status::OK();
-}
-
-Status PluginMgr::uninstall_plugin(const TPluginMetaInfo& info) {
- std::lock_guard<std::mutex> l(_lock);
-
- auto iter = _plugins[info.type].find(info.name);
-
- if (iter != _plugins[info.type].end()) {
- _plugins[info.type].erase(iter);
- }
-
- return Status::OK();
-}
-
-Status PluginMgr::get_plugin(const std::string& name, int type,
std::shared_ptr<Plugin>* plugin) {
- PLUGIN_TYPE_CHECK(type);
-
- std::lock_guard<std::mutex> l(_lock);
-
- auto iter = _plugins[type].find(name);
-
- if (iter != _plugins[type].end()) {
- *plugin = iter->second->plugin();
- return Status::OK();
- }
-
- return Status::NotFound(strings::Substitute("not found type $0 plugin $1",
type, name));
-}
-
-Status PluginMgr::get_plugin(const std::string& name, std::shared_ptr<Plugin>*
plugin) {
- for (int i = 0; i < PLUGIN_TYPE_MAX; ++i) {
- std::lock_guard<std::mutex> l(_lock);
-
- auto iter = _plugins[i].find(name);
-
- if (iter != _plugins[i].end()) {
- *plugin = iter->second->plugin();
- return Status::OK();
- }
- }
-
- return Status::NotFound(strings::Substitute("not found plugin $0", name));
-}
-
-Status PluginMgr::get_plugin_list(int type,
std::vector<std::shared_ptr<Plugin>>* plugin_list) {
- PLUGIN_TYPE_CHECK(type);
-
- std::lock_guard<std::mutex> l(_lock);
-
- for (const PluginLoaderMap::value_type& iter : _plugins[type]) {
- plugin_list->push_back(iter.second->plugin());
- }
-
- return Status::OK();
-}
-
-Status PluginMgr::register_builtin_plugin(const std::string& name, int type,
- const doris::Plugin* plugin) {
- PLUGIN_TYPE_CHECK(type);
-
- std::lock_guard<std::mutex> l(_lock);
-
- auto iter = _plugins[type].find(name);
- if (iter != _plugins[type].end()) {
- return Status::AlreadyExist(
- strings::Substitute("the type $0 plugin $1 already register",
type, name));
- }
-
- std::unique_ptr<PluginLoader> loader =
- std::unique_ptr<PluginLoader>(new BuiltinPluginLoader(name, type,
plugin));
-
- Status st = loader->install();
- if (!st.ok()) {
- RETURN_IF_ERROR(loader->uninstall());
- return st;
- }
-
- _plugins[type][name] = std::move(loader);
-
- return Status::OK();
-}
-
-Status PluginMgr::get_all_plugin_info(std::vector<TPluginInfo>*
plugin_info_list) {
- for (int i = 0; i < PLUGIN_TYPE_MAX; ++i) {
- for (const PluginLoaderMap::value_type& iter : _plugins[i]) {
- TPluginInfo info;
- info.__set_plugin_name(iter.second->name());
- info.__set_type(iter.second->type());
-
- plugin_info_list->push_back(info);
- }
- }
-
- return Status::OK();
-}
-
-} // namespace doris
diff --git a/be/src/plugin/plugin_mgr.h b/be/src/plugin/plugin_mgr.h
deleted file mode 100644
index 44c5eb7..0000000
--- a/be/src/plugin/plugin_mgr.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#ifndef DORIS_BE_PLUGIN_PLUGIN_MGR_H
-#define DORIS_BE_PLUGIN_PLUGIN_MGR_H
-
-#include <memory>
-#include <mutex>
-#include <string>
-#include <unordered_map>
-
-#include "common/status.h"
-#include "gen_cpp/AgentService_types.h"
-#include "gen_cpp/MasterService_types.h"
-#include "plugin/plugin.h"
-#include "plugin/plugin_loader.h"
-
-namespace doris {
-
-typedef std::unordered_map<std::string, std::unique_ptr<PluginLoader>>
PluginLoaderMap;
-
-class PluginMgr {
-public:
- PluginMgr() {}
-
- ~PluginMgr() {}
-
- Status install_plugin(const TPluginMetaInfo& info);
-
- Status uninstall_plugin(const TPluginMetaInfo& info);
-
- Status register_builtin_plugin(const std::string& name, int type, const
Plugin* plugin);
-
- Status get_plugin(const std::string& name, int type,
std::shared_ptr<Plugin>* plugin);
-
- Status get_plugin(const std::string& name, std::shared_ptr<Plugin>*
plugin);
-
- Status get_plugin_list(int type, std::vector<std::shared_ptr<Plugin>>*
plugin_list);
-
- Status get_all_plugin_info(std::vector<TPluginInfo>* plugin_info_list);
-
-private:
- PluginLoaderMap _plugins[PLUGIN_TYPE_MAX];
-
- std::mutex _lock;
-};
-
-} // namespace doris
-
-#endif // DORIS_BE_PLUGIN_PLUGIN_LOADER_H
diff --git a/be/src/plugin/plugin_zip.cpp b/be/src/plugin/plugin_zip.cpp
deleted file mode 100644
index 8434581..0000000
--- a/be/src/plugin/plugin_zip.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#include "plugin/plugin_zip.h"
-
-#include <string.h>
-
-#include <boost/algorithm/string/predicate.hpp>
-
-#include "env/env.h"
-#include "gutil/strings/substitute.h"
-#include "gutil/strings/util.h"
-#include "http/http_client.h"
-#include "util/file_utils.h"
-#include "util/md5.h"
-#include "util/slice.h"
-#include "util/time.h"
-#include "util/zip_util.h"
-
-namespace doris {
-
-using namespace strings;
-
-bool is_local_source(const std::string& source) {
- if (HasPrefixString(source, "http") || HasPrefixString(source, "https")) {
- return false;
- }
-
- return true;
-}
-
-PluginZip::~PluginZip() {
- for (auto& p : _clean_paths) {
- WARN_IF_ERROR(FileUtils::remove_all(p), "clean plugin_zip temp path
failed: " + p);
- }
-}
-
-Status PluginZip::extract(const std::string& target_dir, const std::string&
plugin_name) {
- // check plugin install path
- std::string plugin_install_path = strings::Substitute("$0/$1", target_dir,
plugin_name);
-
- if (FileUtils::check_exist(plugin_install_path)) {
- return Status::AlreadyExist(strings::Substitute("plugin $0 already
install!", plugin_name));
- }
-
- if (!FileUtils::check_exist(target_dir)) {
- RETURN_IF_ERROR(FileUtils::create_dir(target_dir));
- }
-
- std::string zip_path = _source;
- if (!is_local_source(_source)) {
- zip_path = strings::Substitute("$0/.temp_$1_$2.zip", target_dir,
GetCurrentTimeMicros(),
- plugin_name);
- _clean_paths.push_back(zip_path);
-
- RETURN_IF_ERROR(download(zip_path));
- }
-
- // zip extract
- ZipFile zip_file(zip_path);
- RETURN_IF_ERROR(zip_file.extract(target_dir, plugin_name));
-
- return Status::OK();
-}
-
-Status PluginZip::download(const std::string& zip_path) {
- // download .zip
- Status status;
- HttpClient client;
- Md5Digest digest;
-
- std::unique_ptr<WritableFile> file;
-
- RETURN_IF_ERROR(Env::Default()->new_writable_file(zip_path, &file));
- RETURN_IF_ERROR(client.init(_source));
-
- auto download_cb = [&status, &digest, &file](const void* data, size_t
length) {
- digest.update(data, length);
-
- Slice slice((const char*)data, length);
- status = file->append(slice);
- if (!status.ok()) {
- LOG(WARNING) << "fail to download data, file: " << file->filename()
- << ", error: " << status.to_string();
- return false;
- }
-
- return true;
- };
-
- RETURN_IF_ERROR(client.execute(download_cb));
- RETURN_IF_ERROR(status);
- RETURN_IF_ERROR(file->flush(WritableFile::FLUSH_ASYNC));
- RETURN_IF_ERROR(file->sync());
- RETURN_IF_ERROR(file->close());
-
- // md5 check
- HttpClient md5_client;
- RETURN_IF_ERROR(md5_client.init(_source + ".md5"));
-
- std::string expect;
- auto download_md5_cb = [&status, &expect](const void* data, size_t length)
{
- expect = std::string((const char*)data, length);
- return true;
- };
-
- RETURN_IF_ERROR(md5_client.execute(download_md5_cb));
-
- digest.digest();
- if (0 != strncmp(digest.hex().c_str(), expect.c_str(), 32)) {
- return Status::InternalError(strings::Substitute(
- "plugin install checksum failed. expect: $0, actual:$1",
expect, digest.hex()));
- }
-
- return Status::OK();
-}
-
-} // namespace doris
\ No newline at end of file
diff --git a/be/src/plugin/plugin_zip.h b/be/src/plugin/plugin_zip.h
deleted file mode 100644
index ea5af84..0000000
--- a/be/src/plugin/plugin_zip.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#ifndef DORIS_BE_PLUGIN_PLUGIN_ZIP_H
-#define DORIS_BE_PLUGIN_PLUGIN_ZIP_H
-
-#include "common/status.h"
-
-namespace doris {
-
-class PluginZip {
-public:
- PluginZip(std::string source) : _source(source) {}
-
- ~PluginZip();
-
- Status extract(const std::string& target_path, const std::string&
plugin_name);
-
-private:
- Status download(const std::string& zip_path);
-
-private:
- std::string _source;
-
- std::vector<std::string> _clean_paths;
-};
-
-} // namespace doris
-#endif //DORIS_BE_PLUGIN_PLUGIN_ZIP_H
diff --git a/be/src/runtime/exec_env.h b/be/src/runtime/exec_env.h
index 8c8a9fb..39808bf 100644
--- a/be/src/runtime/exec_env.h
+++ b/be/src/runtime/exec_env.h
@@ -58,7 +58,6 @@ class WebPageHandler;
class StreamLoadExecutor;
class RoutineLoadTaskExecutor;
class SmallFileMgr;
-class PluginMgr;
class BackendServiceClient;
class FrontendServiceClient;
@@ -154,8 +153,6 @@ public:
RoutineLoadTaskExecutor* routine_load_task_executor() { return
_routine_load_task_executor; }
HeartbeatFlags* heartbeat_flags() { return _heartbeat_flags; }
- PluginMgr* plugin_mgr() { return _plugin_mgr; }
-
// The root tracker should be set before calling ExecEnv::init();
void set_root_mem_tracker(std::shared_ptr<MemTracker> root_tracker);
@@ -228,7 +225,6 @@ private:
SmallFileMgr* _small_file_mgr = nullptr;
HeartbeatFlags* _heartbeat_flags = nullptr;
- PluginMgr* _plugin_mgr = nullptr;
};
template <>
diff --git a/be/src/runtime/exec_env_init.cpp b/be/src/runtime/exec_env_init.cpp
index 128f52e..eb29e5e 100644
--- a/be/src/runtime/exec_env_init.cpp
+++ b/be/src/runtime/exec_env_init.cpp
@@ -28,7 +28,6 @@
#include "olap/page_cache.h"
#include "olap/segment_loader.h"
#include "olap/storage_engine.h"
-#include "plugin/plugin_mgr.h"
#include "runtime/broker_mgr.h"
#include "runtime/bufferpool/buffer_pool.h"
#include "runtime/bufferpool/reservation_tracker.h"
@@ -130,7 +129,6 @@ Status ExecEnv::_init(const std::vector<StorePath>&
store_paths) {
_stream_load_executor = new StreamLoadExecutor(this);
_routine_load_task_executor = new RoutineLoadTaskExecutor(this);
_small_file_mgr = new SmallFileMgr(this, config::small_file_dir);
- _plugin_mgr = new PluginMgr();
_backend_client_cache->init_metrics("backend");
_frontend_client_cache->init_metrics("frontend");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]