Apache Doris Be development and debugging

    1. Download the doris source code

      URL:apache/incubator-doris: Apache Doris (Incubating) (github.com) (opens new window)

    2. 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

    3. Install other dependent packages

    1. install : libssl-dev

    The following steps are carried out in the /home/workspace directory

    1. dowload source
    1. git clone https://github.com/apache/incubator-doris.git
    1. Compile third-party dependency packages
    1. cd /home/workspace/incubator-doris/thirdparty
    2. ./build-thirdparty.sh
    1. Compile doris product code

    Note: This compilation has the following instructions:

    1. ./build.sh #Compile be and fe at the same time
    2. ./build.sh --be #Only compile be
    3. ./build.sh --fe #Only compilefe
    4. ./build.sh --fe --be --clean#Delete and compile be fe at the same time
    5. ./build.sh --fe --clean#Delete and compile fe
    6. ./build.sh --be --clean#Delete and compile be
    7. ./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 .

    1. Authorize be compilation result files
    1. chmod /home/workspace/incubator-doris/output/be/lib/palo_be
    1. Create a data storage directory

    By viewing /home/workspace/incubator-doris/output/be/conf/be.conf

    1. # INFO, WARNING, ERROR, FATAL
    2. sys_log_level = INFO
    3. be_port = 9060
    4. be_rpc_port = 9070
    5. webserver_port = 8040
    6. heartbeat_service_port = 9050
    7. brpc_port = 8060
    8. # If no ip match this rule, will choose one randomly.
    9. # use CIDR format, e.g. 10.10.10.0/
    10. # Default value is empty.
    11. priority_networks = 192.168.59.0/24 # data root path, seperate by ';'
    12. storage_root_path = /soft/be/storage
    13. # sys_log_dir = ${PALO_HOME}/log
    14. # sys_log_roll_num =
    15. # sys_log_verbose_modules =
    16. # log_buffer_level = -
    17. # palo_cgroups

    Need to create this folder, this is where the be data is stored

    1. 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

    2. Install the vscode ms c++ debugging plug-in, the plug-in identified by the red box in the figure below

    BE development and debugging environment under Linux - 图2

    1. Create a launch.json file, the content of the file is as follows:
    1. {
    2. "version": "0.2.0",
    3. "configurations": [
    4. {
    5. "name": "(gdb) Launch",
    6. "type": "cppdbg",
    7. "request": "launch",
    8. "program": "/home/workspace/incubator-doris/output/be/lib/palo_be",
    9. "args": [],
    10. "stopAtEntry": false,
    11. "cwd": "/home/workspace/incubator-doris/",
    12. "environment": [{"name":"PALO_HOME","value":"/home/workspace/incubator-doris/output/be/"},
    13. {"name":"UDF_RUNTIME_DIR","value":"/home/workspace/incubator-doris/output/be/lib/udf-runtime"},
    14. {"name":"LOG_DIR","value":"/home/workspace/incubator-doris/output/be/log"},
    15. {"name":"PID_DIR","value":"/home/workspace/incubator-doris/output/be/bin"}
    16. ],
    17. "externalConsole": true,
    18. "MIMode": "gdb",
    19. {
    20. "description": "Enable pretty-printing for gdb",
    21. "text": "-enable-pretty-printing",
    22. }
    23. ]
    24. }
    25. ]
    26. }

    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:

    1. {
    2. "version": "0.2.0",
    3. "configurations": [
    4. {
    5. "name": "(gdb) Launch",
    6. "type": "cppdbg",
    7. "request": "attach",
    8. "program": "/home/workspace/incubator-doris/output/lib/palo_be",
    9. "processId":,
    10. "MIMode": "gdb",
    11. "internalConsoleOptions":"openOnSessionStart",
    12. "setupCommands": [
    13. {
    14. "description": "Enable pretty-printing for gdb",
    15. "text": "-enable-pretty-printing",
    16. "ignoreFailures": true
    17. }
    18. ]
    19. }
    20. ]
    21. }

    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:

    1. Click to debug

      You can start your debugging journey with the rest,

    BE development and debugging environment under Linux - 图4