Skip to content

Commit 96521f0

Browse files
💬Generate LLM translations (#1945)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: z <[email protected]>
1 parent a6f275c commit 96521f0

37 files changed

+5002
-4
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
title: 构建 Databend
3+
sidebar_label: 构建 Databend
4+
description: 从源代码获取和构建 Databend
5+
---
6+
7+
作为一个开源平台,Databend 为用户提供了根据其特定需求修改、分发和增强软件的灵活性。此外,用户可以自由地从源代码构建 Databend,从而能够充分了解软件的工作原理并有可能为其开发做出贡献。
8+
9+
:::tip
10+
Databend 提供了一个 Docker 镜像,其中包含开发所需的所有工具,但目前仅适用于 amd64 架构。要使用它,请确保已安装并运行 Docker,然后运行 `INTERACTIVE=true scripts/setup/run_build_tool.sh`。这将启动一个用于构建和测试的环境,`INTERACTIVE=true` 标志启用交互模式。
11+
:::
12+
13+
## 前提条件
14+
15+
在构建 Databend 之前,请确保已满足以下要求:
16+
17+
- 从源代码构建 Databend 至少需要 16 GB 的 RAM。
18+
- 您已安装以下必需工具:
19+
- Git
20+
- cmake
21+
- [rustup](https://rustup.rs/)
22+
23+
## 构建 Databend
24+
25+
按照以下步骤构建 Databend:
26+
27+
1. 下载源代码。
28+
29+
```shell
30+
git clone https://github.com/databendlabs/databend.git
31+
```
32+
33+
2. 安装依赖项并编译源代码。
34+
35+
```shell
36+
cd databend
37+
make setup -d
38+
export PATH=$PATH:~/.cargo/bin
39+
```
40+
41+
3. 构建 Databend。
42+
43+
- 要构建包含调试信息的 Databend 以进行调试,请运行 `make build`。生成的文件将位于 "target/debug/" 目录中。
44+
45+
```shell
46+
make build
47+
```
48+
49+
- 要构建用于生产环境的 Databend,针对您的本地 CPU 进行了优化,请运行 `make build-release`。生成的文件将位于 "target/release/" 目录中。
50+
51+
```shell
52+
make build-release
53+
```
54+
55+
## 启动 Databend 进行调试
56+
57+
```shell
58+
# 1. 首先启动 databend-meta:
59+
nohup target/debug/databend-meta --single --log-level=ERROR &
60+
61+
# 2. 启动 databend-query 并将其连接到 databend-meta:
62+
nohup target/debug/databend-query -c scripts/ci/deploy/config/databend-query-node-1.toml &
63+
```
64+
65+
:::tip
66+
要停止 databend-meta 和 databend-query,请运行以下命令:
67+
68+
```shell
69+
killall -9 databend-meta
70+
killall -9 databend-query
71+
```
72+
73+
:::
74+
75+
## 常见错误
76+
77+
1. 在 osx 中构建:
78+
79+
- 最好使用官方 clang 而不是 apple clang:
80+
81+
```bash
82+
brew install llvm
83+
```
84+
85+
并设置编译器环境,例如:
86+
87+
```bash
88+
export CMAKE_CC_COMPILER=/opt/homebrew/opt/llvm/bin/clang
89+
export CMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++
90+
```
91+
92+
- 使用自定义 jemalloc env 配置:
93+
```bash
94+
export JEMALLOC_SYS_WITH_LG_PAGE=14
95+
export JEMALLOC_SYS_WITH_MALLOC_CONF="oversize_threshold:0,dirty_decay_ms:5000,muzzy_decay_ms:5000"
96+
```
97+
98+
2. protoc failed: Unknown flag: --experimental_allow_proto3_optional\n
99+
100+
```bash
101+
--- stderr
102+
Error: Custom { kind: Other, error: "protoc failed: Unknown flag: --experimental_allow_proto3_optional\n" }
103+
warning: build failed, waiting for other jobs to finish...
104+
All done...
105+
# Reduce binary size by compressing binaries.
106+
objcopy --compress-debug-sections=zlib-gnu /home/aucker/mldb/databend/target/release/databend-query
107+
objcopy: '/home/aucker/mldb/databend/target/release/databend-query': No such file
108+
make: *** [Makefile:51: build-release] Error 1
109+
```
110+
111+
错误消息表明,由于 protoc 使用了一个未知的标志(--experimental_allow_proto3_optional),导致构建 Databend 时出现问题。protoc 是一个协议缓冲区编译器。此标志仅在 protoc 3.12 或更高版本中可用,而当前使用的版本不支持它。
112+
113+
建议的解决方案是升级到支持该标志的 protoc 版本。您可以通过从官方发布页面 (https://github.com/protocolbuffers/protobuf/releases) 下载最新版本的 protoc 并将其安装在您的系统上来实现。
114+
115+
```bash
116+
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
117+
curl -LO $PB_REL/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
118+
unzip protoc-3.15.8-linux-x86_64.zip
119+
$sudo cp bin/protoc /usr/bin/
120+
$protoc --version
121+
libprotoc 3.15.6
122+
```
123+
124+
3. 无法连接到派生的 Databend 项目中的 databend-meta。
125+
126+
此问题可能是由 Databend-meta 中实施的版本检查未被派生项目满足所致。
127+
128+
一种可能的解决方案是使用命令 `git fetch https://github.com/databendlabs/databend.git --tags` 从官方 Databend 存储库中获取最新的标签。这应确保项目使用最新版本的 Databend-meta 并将通过版本检查。
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
---
2+
title: 你的第一个 Databend PR
3+
sidebar_label: 第一个 Pull Request
4+
description: 你的第一个好的 Databend pull request
5+
---
6+
7+
[Databend](https://github.com/databendlabs/databend) 是一个开源项目,每个人都可以贡献他们的代码,并将他们的创意变为现实。本主题帮助新的贡献者了解如何在 GitHub 上为 Databend 创建 pull request,并为代码贡献提供有用的注意事项。
8+
9+
:::tip
10+
**你知道吗?** 为了表示感谢,您的 GitHub 用户名将在您的代码成功合并后添加到 `system.contributors` 表中。
11+
12+
查看它:
13+
14+
`SELECT * FROM system.contributors`
15+
:::
16+
17+
## 前提条件
18+
19+
Databend 是用 Rust 编写的,要从头开始构建 Databend,您需要安装以下工具:
20+
21+
- **Git**
22+
- **Rust** 使用 [rustup](https://rustup.rs/) 安装
23+
24+
## 编码规范
25+
26+
### 代码格式和分析
27+
28+
```shell
29+
$ make lint
30+
```
31+
32+
### 代码文档
33+
34+
任何公共字段、函数和方法都应该使用 [Rustdoc](https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#making-useful-documentation-comments) 进行文档化。
35+
36+
请遵循下面详细介绍的 `modules``structs``enums``functions` 的约定。当导航 Rustdoc 时,_单行_ 用作预览。例如,请参阅 [collections](https://doc.rust-lang.org/std/collections/index.html) Rustdoc 中的“Structs”和“Enums”部分。
37+
38+
```rust
39+
/// [Single line] One line summary description
40+
///
41+
/// [Longer description] Multiple lines, inline code
42+
/// examples, invariants, purpose, usage, etc.
43+
[Attributes] If attributes exist, add after Rustdoc
44+
```
45+
46+
以下示例:
47+
48+
```rust
49+
/// Represents (x, y) of a 2-dimensional grid
50+
///
51+
/// A line is defined by 2 instances.
52+
/// A plane is defined by 3 instances.
53+
#[repr(C)]
54+
struct Point {
55+
x: i32,
56+
y: i32,
57+
}
58+
```
59+
60+
## 贡献文档
61+
62+
我们欢迎您在编写代码的同时,为 Databend 文档做出贡献!Databend 文档由 markdown 文件组成,这使得编写和维护变得容易。为了确保高质量的文档,我们建议使用 [Visual Studio Code](https://code.visualstudio.com/) 作为您的 markdown 编辑器。此外,安装 [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) 扩展程序将帮助您发现任何拼写错误。
63+
64+
当提交新命令或函数的文档时,必须遵守提供的模板和指南,以保持一致性并确保 Databend 文档的清晰度。这些模板旨在包含所有必要的信息和格式约定,使用户更容易理解和使用命令或函数。
65+
66+
- [command-template](https://github.com/databendlabs/databend/blob/d3a40d91b8a8ebaf878344e024164f36b6db5615/docs/public/templates/command-template.md?plain=1)
67+
- [function-template](https://github.com/databendlabs/databend/blob/d3a40d91b8a8ebaf878344e024164f36b6db5615/docs/public/templates/function-template.md?plain=1)
68+
69+
除了遵循模板之外,请注意其中包含的代码。代码的目的是明确指出新命令或函数是否仅适用于 Databend Enterprise,并提供有关何时引入命令或函数的信息。此上下文信息对于用户至关重要,因为它允许他们准确评估功能的范围和限制。它还使用户能够识别支持该功能的 Databend 的特定版本,从而使他们能够有效地规划其使用。
70+
71+
## Pull Requests
72+
73+
### 提交 PR
74+
75+
1. Fork `databend` 仓库,并从 `main` 创建您的分支。
76+
2. 打开一个常规 [issue](https://github.com/databendlabs/databend/issues/new/choose) 以绑定 pull request。
77+
3. 提交一个 [Draft Pull Requests](https://github.blog/2019-02-14-introducing-draft-pull-requests/),标记您正在进行的工作。
78+
4. 如果您添加了应该测试的代码,请添加单元测试。
79+
5. 验证并确保测试套件通过,`make test`
80+
6. 确保您的代码通过了两个 linters,`make lint`
81+
7. 将状态更改为“Ready for review”。
82+
8. 注意来自 `@mergify` 的回复,她将是您的指导。
83+
84+
### PR 标题
85+
86+
格式:`<type>(<scope>): <subject>`
87+
88+
`<scope>` 是可选的
89+
90+
```
91+
fix(query): fix group by string bug
92+
^--^ ^------------^
93+
| |
94+
| +-> Summary in present tense.
95+
|
96+
+-------> Type: rfc, feat, fix, refactor, ci, docs, chore
97+
```
98+
99+
更多类型:
100+
101+
- `rfc`: 此 PR 提出了一个新的 RFC
102+
- `feat`: 此 PR 向代码库引入了一个新功能
103+
- `fix`: 此 PR 修复了代码库中的一个错误
104+
- `refactor`: 此 PR 更改了代码库,但没有新功能或错误修复
105+
- `ci`: 此 PR 更改了构建/ci 步骤
106+
- `docs`: 此 PR 更改了文档或网站
107+
- `chore`: 此 PR 只有小的更改,不需要记录,例如编码风格。
108+
109+
### PR 模板
110+
111+
Databend 有一个 [Pull Request Template](https://github.com/databendlabs/databend/blob/main/.github/PULL_REQUEST_TEMPLATE.md):
112+
113+
```shell
114+
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla
115+
116+
## Summary
117+
118+
Summary about this PR
119+
120+
Fixes #issue
121+
```
122+
123+
您不应该更改 PR 模板上下文,但需要完成:
124+
125+
- `Summary` - 描述构成 Pull Request 的内容以及您对代码所做的更改。例如,修复哪个 issue。
126+
127+
## 测试
128+
129+
_单元测试_
130+
131+
```shell
132+
$ make unit-test
133+
```
134+
135+
_无状态测试_
136+
137+
```shell
138+
$ make stateless-test
139+
```
140+
141+
## Issues
142+
143+
Databend 使用 [GitHub issues](https://github.com/databendlabs/databend/issues) 来跟踪错误。请包括必要的信息和说明来重现您的问题。
144+
145+
## 文档
146+
147+
所有开发者文档都发布在 Databend 开发者网站 [databend.com](/guides) 上。
148+
149+
## 行为准则
150+
151+
请参阅 [行为准则](/dev/policies/code-of-conduct),其中描述了社区内互动的期望。

0 commit comments

Comments
 (0)