Apache Doris Be development and debugging
Download the doris source code
URL:apache/incubator-doris: Apache Doris (Incubating) (github.com) (opens new window)
Install GCC 8.3.1+, Oracle JDK 1.8+, Python 2.7+, confirm that the gcc, java, python commands point to the correct version, and set the JAVA_HOME environment variable
Install other dependent packages
- install : libssl-dev
The following steps are carried out in the /home/workspace directory
- dowload source
git clone https://github.com/apache/incubator-doris.git
- Compile third-party dependency packages
cd /home/workspace/incubator-doris/thirdparty
./build-thirdparty.sh
- Compile doris product code
Note: This compilation has the following instructions:
./build.sh #Compile be and fe at the same time
./build.sh --be #Only compile be
./build.sh --fe #Only compilefe
./build.sh --fe --be --clean#Delete and compile be fe at the same time
./build.sh --fe --clean#Delete and compile fe
./build.sh --be --clean#Delete and compile be
./build.sh --be --fe --clean#Delete and compile be fe at the same time
If nothing happens, the compilation should be successful, and the final deployment file will be output to the /home/zhangfeng/incubator-doris/output/ directory. If you still encounter other problems, you can refer to the doris installation document .
- Authorize be compilation result files
chmod /home/workspace/incubator-doris/output/be/lib/palo_be
- Create a data storage directory
By viewing /home/workspace/incubator-doris/output/be/conf/be.conf
# INFO, WARNING, ERROR, FATAL
sys_log_level = INFO
be_port = 9060
be_rpc_port = 9070
webserver_port = 8040
heartbeat_service_port = 9050
brpc_port = 8060
# If no ip match this rule, will choose one randomly.
# use CIDR format, e.g. 10.10.10.0/
# Default value is empty.
priority_networks = 192.168.59.0/24 # data root path, seperate by ';'
storage_root_path = /soft/be/storage
# sys_log_dir = ${PALO_HOME}/log
# sys_log_roll_num =
# sys_log_verbose_modules =
# log_buffer_level = -
# palo_cgroups
Need to create this folder, this is where the be data is stored
Open vscode, and open the directory where the be source code is located. In this case, open the directory as /home/workspace/incubator-doris/,For details on how to vscode, refer to the online tutorial
Install the vscode ms c++ debugging plug-in, the plug-in identified by the red box in the figure below
- Create a launch.json file, the content of the file is as follows:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/home/workspace/incubator-doris/output/be/lib/palo_be",
"args": [],
"stopAtEntry": false,
"cwd": "/home/workspace/incubator-doris/",
"environment": [{"name":"PALO_HOME","value":"/home/workspace/incubator-doris/output/be/"},
{"name":"UDF_RUNTIME_DIR","value":"/home/workspace/incubator-doris/output/be/lib/udf-runtime"},
{"name":"LOG_DIR","value":"/home/workspace/incubator-doris/output/be/log"},
{"name":"PID_DIR","value":"/home/workspace/incubator-doris/output/be/bin"}
],
"externalConsole": true,
"MIMode": "gdb",
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
}
]
}
]
}
Among them, environment defines several environment variables DORIS_HOME UDF_RUNTIME_DIR LOG_DIR PID_DIR, which are the environment variables needed when palo_be is running. If it is not set, the startup will fail
Note: If you want attach (additional process) debugging, the configuration code is as follows:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "attach",
"program": "/home/workspace/incubator-doris/output/lib/palo_be",
"processId":,
"MIMode": "gdb",
"internalConsoleOptions":"openOnSessionStart",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
As shown in the figure:
Among them, 15200 is the process id of the currently running be.
An example of a complete lainch.json is as follows:
Click to debug
You can start your debugging journey with the rest,