From ef2ea1806e4fb77369ab17a02d20fc8a286be43e Mon Sep 17 00:00:00 2001 From: HB <137497191@qq.com> Date: Mon, 13 Dec 2021 16:26:45 +0800 Subject: [PATCH] [docs] Improve the chapter on debugging FE in doc. (#7309) At present, there are defects in the chapter on debugging FE in doc. My colleagues and I stepped on the pit when building the debugging environment, so I want to improve this chapter in combination with my own stepping on the pit experience. The following is my explanation of the changes: 1. mkdir -p ./thirdparty/installed/bin explain: When I downloaded versions 0.14 and 0.15, there were no files under thirdparty, so I didn't know whether to create it myself or what to do. Finally, I decided to create it myself. I think it's necessary to add instructions here. 2. Add installation thrift@0.13.0 Failed handling method. explain: My colleagues and I failed to find the installation package when executing the installation command, and finally found a solution on GitHub. Therefore, I added the handling method of the problem to avoid other Mac users from getting stuck in this place. 3. Fixed an error in the generated code description. explain: Before I finished building the code, I debugged FE, and I failed all the time. Idea hints that no files can be found. Later, after consulting with morningman in wechat group, it was understood that `mvn install -DskipTests` does not need to execute `mvn generate-sources` after execution. This is inconsistent with the description in the document and needs to be corrected. --- docs/en/developer-guide/fe-idea-dev.md | 73 +++++++++++++---------- docs/zh-CN/developer-guide/fe-idea-dev.md | 27 ++++++--- 2 files changed, 62 insertions(+), 38 deletions(-) diff --git a/docs/en/developer-guide/fe-idea-dev.md b/docs/en/developer-guide/fe-idea-dev.md index fac8f7caae..6ad1fd03f9 100644 --- a/docs/en/developer-guide/fe-idea-dev.md +++ b/docs/en/developer-guide/fe-idea-dev.md @@ -26,61 +26,72 @@ under the License. # Setting Up Development Environment for FE using IntelliJ IDEA -## Prerequisites +## 1. Environmental Preparation * Git * JDK1.8+ * IntelliJ IDEA * Maven (Optional, IDEA shipped embedded Maven3) -## Clone Code +1. Git clone codebase from https://github.com/apache/incubator-doris.git -Git clone codebase from https://github.com/apache/incubator-doris.git -## Code Generation +2. Use IntelliJ IDEA to open the code root directory -If your are only interested in FE module, and for some reason you can't or don't want to compile full thirdparty libraries, -the minimum tool required for FE module is `thrift`, so you can manually install `thrift` and copy or create a link of -the executable `thrift` command to `./thirdparty/installed/bin`. -Doris build against `thrift` 0.13.0 ( note : `Doris` 0.15 and later version build against `thrift` 0.13.0 , the previous version is still `thrift` 0.9.3) +3. If your are only interested in FE module, and for some reason you can't or don't want to compile full thirdparty libraries, + the minimum tool required for FE module is `thrift`, so you can manually install `thrift` and copy or create a link of + the executable `thrift` command to `./thirdparty/installed/bin`. + ``` + Doris build against `thrift` 0.13.0 ( note : `Doris` 0.15 and later version build against `thrift` 0.13.0 , the previous version is still `thrift` 0.9.3) + + Windows: + 1. Download:`http://archive.apache.org/dist/thrift/0.13.0/thrift-0.13.0.exe` + 2. Copy:copy the file to `./thirdparty/installed/bin` + + MacOS: + 1. Download:`brew install thrift@0.13.0` + 2. Establish soft connection: + `mkdir -p ./thirdparty/installed/bin` + `ln -s /opt/homebrew/Cellar/thrift@0.13.0/0.13.0/bin/thrift ./thirdparty/installed/bin/thrift` + + Note:The error that the version cannot be found may be reported when MacOS execute `brew install thrift@0.13.0`. The solution is execute at the terminal as follows: + 1. `brew tap-new $USER/local-tap` + 2. `brew extract --version='0.13.0' thrift $USER/local-tap` + 3. `brew install thrift@0.13.0` + Reference link: `https://gist.github.com/tonydeng/02e571f273d6cce4230dc8d5f394493c` + ``` -If your are using macOS, try `brew install thrift@0.13.0` and will get `thrift` 0.13.0 installed at `/usr/local/opt/thrift@0.13.0/bin/thrift`, -then create a soft link to `./thirdparty/installed/bin/thrift`. - -For Windows users, download `thrift` 0.13.0 from `http://archive.apache.org/dist/thrift/0.13.0/thrift-0.13.0.exe`, -and put it into `thirdparty/installed/bin/` folder. +4. Go to `./fe` folder and run the following maven command to generate sources. -Go to `./fe` folder and run the following maven command to generate sources. - -``` -mvn generate-sources -``` - -If fails, run following command first to try to install modules into maven local repository, then re-run above command. - -``` -mvn install -DskipTests -``` - -You can also use IDE embedded GUI tools to run maven command to generate sources + ``` + mvn generate-sources + ``` + + If fails, run following command. + + ``` + mvn clean install -DskipTests + ``` + + You can also use IDE embedded GUI tools to run maven command to generate sources ![](/images/gen_code.png) If you are developing on the OS which lack of support to run `shell script` and `make` such as Windows, a workround here is generate codes in Linux and copy them back. Using Docker should also be an option. -## Import into IDEA +## 2. Debug 1. Import `./fe` into IDEA -2. Follow the picture to create the folders +2. Follow the picture to create the folders (The directory may exist in the new version. If it exists, skip it, otherwise create it.) ![](/images/DEBUG4.png) 3. Build `ui` project , and copy files from directory `ui/dist` into directory `webroot` ( you can skip this step , if you don't need `Doris` UI ) -## Custom FE configuration +## 3. Custom FE configuration Copy below content into `conf/fe.conf` and tune it to fit your environment. @@ -157,12 +168,12 @@ mysql_service_nio_enabled = true ``` -## Setting Environment Variables +## 4. Setting Environment Variables Follow the picture to set runtime Environment Variables in IDEA ![](/images/DEBUG5.png) -## Start FE +## 5. Start FE Having fun with Doris FE! diff --git a/docs/zh-CN/developer-guide/fe-idea-dev.md b/docs/zh-CN/developer-guide/fe-idea-dev.md index 9fae981a9e..a7e6338dd2 100644 --- a/docs/zh-CN/developer-guide/fe-idea-dev.md +++ b/docs/zh-CN/developer-guide/fe-idea-dev.md @@ -37,24 +37,37 @@ JDK1.8+, IntelliJ IDEA 3. 如果仅进行fe开发而没有编译过thirdparty,则需要安装thrift,并将thrift 复制或者连接到 `thirdparty/installed/bin` 目录下 安装 `thrift` 0.13.0 版本(注意:`Doris` 0.15 和最新的版本基于 `thrift` 0.13.0 构建, 之前的版本依然使用`thrift` 0.9.3 构建) + + Windows: + 1. 下载:`http://archive.apache.org/dist/thrift/0.13.0/thrift-0.13.0.exe` + 2. 拷贝:将文件拷贝至 `./thirdparty/installed/bin` - MacOS: `brew install thrift@0.13.0` - Windows: `http://archive.apache.org/dist/thrift/0.13.0/thrift-0.13.0.exe` + MacOS: + 1. 下载:`brew install thrift@0.13.0` + 2. 建立软链接: + `mkdir -p ./thirdparty/installed/bin` + `ln -s /opt/homebrew/Cellar/thrift@0.13.0/0.13.0/bin/thrift ./thirdparty/installed/bin/thrift` + + 注:MacOS执行 `brew install thrift@0.13.0` 可能会报找不到版本的错误,解决方法如下,在终端执行: + 1. `brew tap-new $USER/local-tap` + 2. `brew extract --version='0.13.0' thrift $USER/local-tap` + 3. `brew install thrift@0.13.0` + 参考链接: `https://gist.github.com/tonydeng/02e571f273d6cce4230dc8d5f394493c` 4. 如果是Mac 或者 Linux 环境 可以通过 如下命令生成自动生成代码: ``` cd fe - mvn generate-sources + mvn generate-sources ``` - 如果出现错误,请先执行: + 如果出现错误,则执行: ``` - cd fe && mvn install -DskipTests + cd fe && mvn clean install -DskipTests ``` -或者通过图形界面运行运行maven 命令生成 +或者通过图形界面运行 maven 命令生成 ![](/images/gen_code.png) @@ -64,7 +77,7 @@ JDK1.8+, IntelliJ IDEA 1. 用idea导入fe工程 -2. 在fe目录下创建下面红框标出的目录 +2. 在fe目录下创建下面红框标出的目录(在新版本中该目录可能存在,如存在则跳过,否则创建) ![](/images/DEBUG4.png)