Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fengzhao committed Aug 30, 2024
1 parent 79cf9e7 commit 11c5019
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions docs/advanced/5.MySQL源代码调试环境.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 概述

在如今开源数据库的时代,越来越多的人开始研究数据库的源码,并给社区贡献代码,MySQL 官方每次发布新版本都要感谢一些在社区上贡献代码的程序员。
现在新的数据库时代也给 DBA 提出了更高的要求,学会调试源码,通过源码定位问题,这是 DBA 进阶的方向。MySQL 的源码有几百上千万行,想全部搞懂几乎是不可能的,研究源码一般推荐从某个功能点入手。
而学会调试源码,不管对研究源码或通过源码定位问题,都是必备的技能。

一般在实际应用中,`MySQL` 都是运行在 `Linux` 平台下,在 `Linux` 平台下一般是通过 `GDB(GNU symbolic debugger)`工具进行调试,`C/C++` 项目的开发和调试包括故障排查都是利用 `GDB` 完成的。
此外,VSCODE 这种 IDE 工具可以在本地的 Windows 操作系统下,通过 ssh 远程调试 Linux 平台下的 MySQL
如果要在 Windows 上调试 Windows Vscode 插件

- C/C++
- C/C++ Clang Command Adapter
- CodeLLDB
- CMake Tools

- <span style="color:blue">**重要的事情提前说**:mysql8.x 是天坑,编译时文件解压的空间强烈建议>40G!!!!30G 真得很勉强,成功全靠运气!编译等了 one hour,系统告诉你硬盘空间不足:)<span style="color:blue">
- **重要的事情提前说**:请准备好足够的时间,我 8 核 16G 的服务器,编译了很长时间,大概是三个多小时
- **重要的事情提前说**:编译异常后,需要删除对应的 cmake cache 后再次进行编译,否则每次都会读取缓存进行相同的报错。
2 changes: 1 addition & 1 deletion docs/foundmental/suoyin.md
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ select id, SUM(cnt) from t group by id asc;
https://dev.mysql.com/blog-archive/removal-of-implicit-and-explicit-sorting-for-group-by/
```

要对一组数据进行分组,MySQL 优化器会选择不同的方法。其中之一是分组之前对数据排序。这使得连续分组变得很容易。
<span style="color:blue"> 要对一组数据进行分组,MySQL 优化器会选择不同的方法。其中之一是分组之前对数据排序。这使得连续分组变得很容易。</span>

如果已经有一个索引可用于获取排序的数据,那么使用它的成本会非常低廉。如果没有索引,MySQL 优化器仍然可以决定在分组之前进行外部(filesort)排序。

Expand Down

0 comments on commit 11c5019

Please sign in to comment.