Skip to content

Commit

Permalink
Change variable and namespace name in BE (apache#268)
Browse files Browse the repository at this point in the history
Change 'palo' to 'doris'
  • Loading branch information
chenhao7253886 authored and morningman committed Nov 2, 2018
1 parent ad12d90 commit 37b4caf
Show file tree
Hide file tree
Showing 923 changed files with 4,662 additions and 4,662 deletions.
2 changes: 1 addition & 1 deletion be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ set(DORIS_LINK_LIBS
Service
Udf
Util
PaloGen
DorisGen
Webserver
TestUtil
AES
Expand Down
2 changes: 1 addition & 1 deletion be/src/aes/my_aes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@param rkey [out] Real key (used by OpenSSL/YaSSL)
@param opmode [out] encryption mode
*/
namespace palo {
namespace doris {
void my_aes_create_key(const unsigned char *key, uint key_length,
uint8 *rkey, enum my_aes_opmode opmode)
{
Expand Down
2 changes: 1 addition & 1 deletion be/src/aes/my_aes.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ enum my_aes_opmode

/** String representations of the supported AES modes. Keep in sync with my_aes_opmode */
extern const char *my_aes_opmode_names[];
namespace palo {
namespace doris {
/**
Encrypt a buffer using AES
Expand Down
6 changes: 3 additions & 3 deletions be/src/aes/my_aes_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#ifndef BDG_PALO_BE_EXPRS_MY_AES_IMPL_H
#define BDG_PALO_BE_EXPRS_MY_AES_IMPL_H
#ifndef DORIS_BE_EXPRS_MY_AES_IMPL_H
#define DORIS_BE_EXPRS_MY_AES_IMPL_H

/** Maximum supported key kength */
const int MAX_AES_KEY_LENGTH = 256;
Expand All @@ -27,7 +27,7 @@ const int MAX_AES_KEY_LENGTH = 256;
typedef uint32_t uint;
typedef uint8_t uint8;

namespace palo {
namespace doris {

extern uint *my_aes_opmode_key_sizes;
void my_aes_create_key(const unsigned char *key, uint key_length,
Expand Down
2 changes: 1 addition & 1 deletion be/src/aes/my_aes_openssl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define DBUG_ASSERT(A) assert(A)
#define TRUE true
#define FALSE false
namespace palo {
namespace doris {
/* keep in sync with enum my_aes_opmode in my_aes.h */
const char *my_aes_opmode_names[]=
{
Expand Down
6 changes: 3 additions & 3 deletions be/src/agent/agent_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ using std::string;
using std::to_string;
using std::vector;

namespace palo {
namespace doris {

AgentServer::AgentServer(ExecEnv* exec_env,
const TMasterInfo& master_info) :
Expand Down Expand Up @@ -187,7 +187,7 @@ AgentServer::AgentServer(ExecEnv* exec_env,
// Add subscriber here and register listeners
TopicListener* user_resource_listener = new UserResourceListener(exec_env, master_info);
LOG(INFO) << "Register user resource listener";
_topic_subscriber->register_listener(palo::TTopicType::type::RESOURCE, user_resource_listener);
_topic_subscriber->register_listener(doris::TTopicType::type::RESOURCE, user_resource_listener);
#endif
}

Expand Down Expand Up @@ -522,4 +522,4 @@ void AgentServer::delete_etl_files(TAgentResult& result,
status.to_thrift(&result.status);
}

} // namesapce palo
} // namesapce doris
10 changes: 5 additions & 5 deletions be/src/agent/agent_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.

#ifndef BDG_PALO_BE_SRC_AGENT_AGENT_SERVER_H
#define BDG_PALO_BE_SRC_AGENT_AGENT_SERVER_H
#ifndef DORIS_BE_SRC_AGENT_AGENT_SERVER_H
#define DORIS_BE_SRC_AGENT_AGENT_SERVER_H

#include "thrift/transport/TTransportUtils.h"
#include "agent/status.h"
Expand All @@ -29,7 +29,7 @@
#include "olap/utils.h"
#include "runtime/exec_env.h"

namespace palo {
namespace doris {

class AgentServer {
public:
Expand Down Expand Up @@ -119,5 +119,5 @@ class AgentServer {

TopicSubscriber* _topic_subscriber;
}; // class AgentServer
} // namespace palo
#endif // BDG_PALO_BE_SRC_AGENT_AGENT_SERVER_H
} // namespace doris
#endif // DORIS_BE_SRC_AGENT_AGENT_SERVER_H
68 changes: 34 additions & 34 deletions be/src/agent/cgroups_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ using std::stringstream;
using apache::thrift::TException;
using apache::thrift::transport::TTransportException;

namespace palo {
namespace doris {

static CgroupsMgr *s_global_cg_mgr;

Expand Down Expand Up @@ -67,12 +67,12 @@ AgentStatus CgroupsMgr::update_local_cgroups(const TFetchResourceResult& new_fe

std::lock_guard<std::mutex> lck(_update_cgroups_mtx);
if (!_is_cgroups_init_success) {
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}


if (_cur_version >= new_fetched_resource.resourceVersion) {
return AgentStatus::PALO_SUCCESS;
return AgentStatus::DORIS_SUCCESS;
}

const std::map<std::string, TUserResource>& new_user_resource
Expand Down Expand Up @@ -114,7 +114,7 @@ AgentStatus CgroupsMgr::update_local_cgroups(const TFetchResourceResult& new_fe

// Using resource version, not subscribe version
_cur_version = new_fetched_resource.resourceVersion;
return AgentStatus::PALO_SUCCESS;
return AgentStatus::DORIS_SUCCESS;
}

void CgroupsMgr::_config_user_disk_throttle(std::string user_name,
Expand Down Expand Up @@ -183,7 +183,7 @@ AgentStatus CgroupsMgr::_config_disk_throttle(std::string user_name,
if (!is_file_exist(cgroups_path.c_str())) {
if (!boost::filesystem::create_directory(cgroups_path)) {
LOG(ERROR) << "Create cgroups: " << cgroups_path << " failed";
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
}

Expand Down Expand Up @@ -246,7 +246,7 @@ AgentStatus CgroupsMgr::_config_disk_throttle(std::string user_name,
ctrl_cmd.str(std::string());
}
}
return AgentStatus::PALO_SUCCESS;
return AgentStatus::DORIS_SUCCESS;
}

AgentStatus CgroupsMgr::modify_user_cgroups(const string& user_name,
Expand All @@ -257,7 +257,7 @@ AgentStatus CgroupsMgr::modify_user_cgroups(const string& user_name,
if (!is_file_exist(user_cgroups_path.c_str())) {
if (!boost::filesystem::create_directory(user_cgroups_path)) {
LOG(ERROR) << "Create cgroups for user " << user_name << " failed";
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
}

Expand All @@ -270,7 +270,7 @@ AgentStatus CgroupsMgr::modify_user_cgroups(const string& user_name,
string user_resource_path = user_cgroups_path + "/" + resource_file_name;
std::ofstream user_cgroups(user_resource_path.c_str(), std::ios::out | std::ios::app);
if (!user_cgroups.is_open()) {
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
user_cgroups << user_share_weight << std::endl;
user_cgroups.close();
Expand All @@ -284,7 +284,7 @@ AgentStatus CgroupsMgr::modify_user_cgroups(const string& user_name,
string level_cgroups_path = user_cgroups_path + "/" + level_name;
if (!is_file_exist(level_cgroups_path.c_str())) {
if (!boost::filesystem::create_directory(level_cgroups_path)) {
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
}

Expand All @@ -293,15 +293,15 @@ AgentStatus CgroupsMgr::modify_user_cgroups(const string& user_name,
std::ofstream level_cgroups(level_resource_path.c_str(),
std::ios::out | std::ios::app);
if (!level_cgroups.is_open()) {
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
level_cgroups << level_share_weight << std::endl;
level_cgroups.close();

LOG(INFO) << "Append " << level_share_weight << " to " << level_resource_path;
}
}
return AgentStatus::PALO_SUCCESS;
return AgentStatus::DORIS_SUCCESS;
}

AgentStatus CgroupsMgr::init_cgroups() {
Expand All @@ -316,15 +316,15 @@ AgentStatus CgroupsMgr::init_cgroups() {
if (fs_type.f_type != CGROUP_SUPER_MAGIC) {
LOG(ERROR) << _root_cgroups_path << " is not a cgroups file system.";
_is_cgroups_init_success = false;
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
#endif
// Check if current user have write permission to cgroup folder
if (access(_root_cgroups_path.c_str(), W_OK) != 0) {
LOG(ERROR) << "Palo does not have write permission to "
LOG(ERROR) << "Doris does not have write permission to "
<< _root_cgroups_path;
_is_cgroups_init_success = false;
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
// If root folder exists, then delete all subfolders under it
boost::filesystem::directory_iterator item_begin(this->_root_cgroups_path);
Expand All @@ -333,23 +333,23 @@ AgentStatus CgroupsMgr::init_cgroups() {
if (is_directory(item_begin->path().string().c_str())) {
// Delete the sub folder
if (delete_user_cgroups(item_begin->path().filename().string())
!= AgentStatus::PALO_SUCCESS) {
!= AgentStatus::DORIS_SUCCESS) {
LOG(ERROR) << "Could not clean subfolder "
<< item_begin->path().string();
_is_cgroups_init_success = false;
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
}
}
LOG(INFO) << "Initialize palo cgroups successfully under folder "
LOG(INFO) << "Initialize doris cgroups successfully under folder "
<< _root_cgroups_path;
_is_cgroups_init_success = true;
return AgentStatus::PALO_SUCCESS;
return AgentStatus::DORIS_SUCCESS;
} else {
LOG(ERROR) << "Could not find a valid cgroups path for resource isolation,"
<< "current value is " << _root_cgroups_path;
_is_cgroups_init_success = false;
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
}

Expand All @@ -364,7 +364,7 @@ void CgroupsMgr::apply_cgroup(const string& user_name, const string& level) {
AgentStatus CgroupsMgr::assign_to_cgroups(const string& user_name,
const string& level) {
if (!_is_cgroups_init_success) {
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
int64_t tid = gettid();
return assign_thread_to_cgroups(tid, user_name, level);
Expand All @@ -374,7 +374,7 @@ AgentStatus CgroupsMgr::assign_thread_to_cgroups(int64_t thread_id,
const string& user_name,
const string& level) {
if (!_is_cgroups_init_success) {
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
string tasks_path = _root_cgroups_path + "/" + user_name + "/" + level + "/tasks";
if (!is_file_exist(_root_cgroups_path + "/" + user_name)) {
Expand All @@ -386,19 +386,19 @@ AgentStatus CgroupsMgr::assign_thread_to_cgroups(int64_t thread_id,
}
if (!is_file_exist(tasks_path.c_str())) {
LOG(ERROR) << "Cgroups path " << tasks_path << " not exist!";
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
std::ofstream tasks(tasks_path.c_str(), std::ios::out | std::ios::app);
if (!tasks.is_open()) {
// This means palo could not open this file. May be it does not have access to it
// This means doris could not open this file. May be it does not have access to it
LOG(ERROR) << "Echo thread: " << thread_id << " to " << tasks_path << " failed!";
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
// Append thread id to the tasks file directly
tasks << thread_id << std::endl;
tasks.close();

return AgentStatus::PALO_SUCCESS;
return AgentStatus::DORIS_SUCCESS;
}

AgentStatus CgroupsMgr::delete_user_cgroups(const string& user_name) {
Expand All @@ -411,16 +411,16 @@ AgentStatus CgroupsMgr::delete_user_cgroups(const string& user_name) {
if (is_directory(item_begin->path().string().c_str())) {
string cur_cgroups_path = item_begin->path().string();
if (this->drop_cgroups(cur_cgroups_path) < 0) {
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
}
}
// Delete user cgroups
if (this->drop_cgroups(user_cgroups_path) < 0) {
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
}
return AgentStatus::PALO_SUCCESS;
return AgentStatus::DORIS_SUCCESS;
}

AgentStatus CgroupsMgr::drop_cgroups(const string& deleted_cgroups_path) {
Expand All @@ -439,22 +439,22 @@ AgentStatus CgroupsMgr::drop_cgroups(const string& deleted_cgroups_path) {
if (i == this->_drop_retry_times){
LOG(ERROR) << "drop cgroups under path: " << deleted_cgroups_path
<< " failed.";
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
}
return AgentStatus::PALO_SUCCESS;
return AgentStatus::DORIS_SUCCESS;
}

AgentStatus CgroupsMgr::relocate_tasks(const string& src_cgroups, const string& dest_cgroups) {
string src_tasks_path = src_cgroups + "/tasks";
string dest_tasks_path = dest_cgroups + "/tasks";
std::ifstream src_tasks(src_tasks_path.c_str());
if (!src_tasks) {
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
std::ofstream dest_tasks(dest_tasks_path.c_str(), std::ios::out | std::ios::app);
if (!dest_tasks) {
return AgentStatus::PALO_ERROR;
return AgentStatus::DORIS_ERROR;
}
int64_t taskid;
while (src_tasks >> taskid) {
Expand All @@ -465,7 +465,7 @@ AgentStatus CgroupsMgr::relocate_tasks(const string& src_cgroups, const string&
}
src_tasks.close();
dest_tasks.close();
return AgentStatus::PALO_SUCCESS;
return AgentStatus::DORIS_SUCCESS;
}

void CgroupsMgr::_echo_cmd_to_cgroup(stringstream& ctrl_cmd, string& cgroups_path) {
Expand Down Expand Up @@ -501,4 +501,4 @@ bool CgroupsMgr::is_file_exist(const std::string& file_path) {
return is_file_exist(file_path.c_str());
}

} // namespace palo
} // namespace doris
8 changes: 4 additions & 4 deletions be/src/agent/cgroups_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.

#ifndef BDG_PALO_BE_SRC_AGENT_CGROUPS_MGR_H
#define BDG_PALO_BE_SRC_AGENT_CGROUPS_MGR_H
#ifndef DORIS_BE_SRC_AGENT_CGROUPS_MGR_H
#define DORIS_BE_SRC_AGENT_CGROUPS_MGR_H

#include <cstdint>
#include <map>
Expand All @@ -26,15 +26,15 @@
#include "agent/status.h"
#include "gen_cpp/MasterService_types.h"

namespace palo {
namespace doris {

class ExecEnv;

class CgroupsMgr {
public:
// Input parameters:
// exec_env: global variable to get global objects
// cgroups_root_path: root cgroup allocated to palo by admin
// cgroups_root_path: root cgroup allocated to doris by admin
explicit CgroupsMgr(ExecEnv* exec_env, const std::string& root_cgroups_path);
~CgroupsMgr();

Expand Down
Loading

0 comments on commit 37b4caf

Please sign in to comment.