Commit 格式规范
基本提交规范
提交格式:
英文(EN)
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
中文(CH)
<类型>[可选的作用域]: <描述>
// 空一行
[可选的正文]
// 空一行
[可选的脚注]
提交说明:
# 标题行:50个字符以内,描述主要变更内容
#
# 主体内容:更详细的说明文本,建议72个字符以内。 需要描述的信息包括:
#
# * 为什么这个变更是必须的? 它可能是用来修复一个bug,增加一个feature,提升性能、可靠性、稳定性等等
# * 他如何解决这个问题? 具体描述解决问题的步骤
# * 是否存在副作用、风险?
#
# 尾部:如果需要的化可以添加一个链接到issue地址或者其它文档,或者关闭某个issue。
提交样例:
fix: correct minor typos in code
see the issue for details
on typos fixed.
Reviewed-by: Z
Refs #133
Commit 分为“标题”和“内容”。原则上标题全部小写。内容首字母大写。
详细说明
Header
Header部分只有一行,包括三个字段:type(必需)、scope(可选)和subject(必需)
type
type为必填项,用于指定commit的类型,约定了feat、fix两个主要type,以及docs、style、refactor、test、 chore、五个特殊type,其余type扩充build、perf、ci、revert,也可以根据公司特殊要求做对应的扩展。
主要:
feat:新功能(feature)fix:修复bug
特殊:
docs:文档(documentation),只改动了文档相关的内容style:格式(不影响代码含义的改动,例如去掉空格、改变缩进、增删分号)refactor:重构(代码重构时使用、不是新增功能,也不是修改bug的代码变动,代码重构,未新增任何功能和修复任何bug)test:添加测试或者修改现有测试chore:构建过程或辅助工具的变动、不修改src或者test的其余修改
扩充:
build:改变构建流程,新增依赖库、工具、构造工具的或者外部依赖的改动,例如webpack,npmperf:提高性能的改动ci:自动化流程配置修改、与CI(持续集成服务)有关的改动revert:回滚到上一个版本,执行git revert打印的message
scope
scope也为必填项,用于说明 commit 影响的范围,比如数据层、控制层、视图层等等,视项目不同而不同,格式为项目名/模块名。
例如: 本次提交涉及的模块范围。因为功能模块繁多,在此仅罗列部分,后续根据需求不断完善。
- planner
- meta
- storage
- stream-load
- broker-load
- routine-load
- sync-job
- export
- executor
- spark-connector
- flink-connector
- datax
- log
- cache
- config
- vectorization
- docs
- profile
标题需尽量清晰表明本次提交的主要内容。
fedesign-cli/common模块删除通用头部组件,而每个页面头部不同。建议分开独立开发,不需要引用统一头部组件。
subject
subject是 commit 目的的简短描述,不超过50个字符。 填写要求:
- 以动词开头,使用第一人称现在时,比如change,而不是changed或changes
- 第一个字母小写
- 结尾不加句号
.
Body
- 内容 commit message 需遵循以下格式:
issue:#7777
your message
1.如无 issue,可不填。issue 也可以出现在 message 里。 2. 一行原则不超过100个字符。
- 示例
[fix](executor) change DateTimeValue's memory layout to load (#7022)
Change DateTimeValue memory's layout to old to fix compatibility problems.
[feat](log) extend logger interface, support structured log output(#6600)
Support structured logging.
[fix][feat-opt](executor)(load)(config) fix some memory bugs (#6699)
1. Fix a memory leak in `collect_iterator.cpp` (Fix #6700)2. Add a new BE config `max_segment_num_per_rowset` to limit the num of segment in new rowset.(Fix #6701)3. Make the error msg of stream load more friendly.
[feat-opt](load) Reduce the number of segments when loading a large volume data in one batch (#6947)
## Case
In the load process, each tablet will have a memtable to save the incoming data,
and if the data in a memtable is larger than 100MB, it will be flushed to disk
as a `segment` file. And then a new memtable will be created to save the following data.
Assume that this is a table with N buckets(tablets). So the max size of all memtables
will be `N * 100MB`. If N is large, it will cost too much memory.
So for memory limit purpose, when the size of all memtables reach a threshold(2GB as default),
Doris will try to flush all current memtables to disk(even if their size are not reach 100MB).
So you will see that the memtable will be flushed when it's size reach `2GB/N`, which maybe much
smaller than 100MB, resulting in too many small segment files.
## Solution
When decide to flush memtable to reduce memory consumption, NOT to flush all memtable,
but to flush part of them.
For example, there are 50 tablets(with 50 memtables). The memory limit is 1GB,
so when each memtable reach 20MB, the total size reach 1GB, and flush will occur.
If I only flush 25 of 50 memtables, then next time when the total size reach 1GB,
there will be 25 memtables with size 10MB, and other 25 memtables with size 30MB.
So I can flush those memtables with size 30MB, which is larger than 20MB.
The main idea is to introduce some jitter during flush to ensure the small unevenness
of each memtable, so as to ensure that flush will only be triggered when the memtable
is large enough.
In my test, loading a table with 48 buckets, mem limit 2G, in previous version,
the average memtable size is 44MB, after modification, the average size is 82MB
Footer
Footer 部分只用于两种情况。
(1)不兼容变动
如果当前代码与上一个版本不兼容,则 Footer 部分以BREAKING CHANGE开头,后面是对变动的描述、以及变动理由和迁移方法。
BREAKING CHANGE: isolate scope bindings definition has changed.
To migrate the code follow the example below:
Before:
scope: {
myAttr: 'attribute',
}
After:
scope: {
myAttr: '@',
}
The removed `inject` wasn't generaly useful for directives so there should be no code using it.
(2)关闭 Issue
如果当前 commit 针对某个issue,那么可以在 Footer 部分关闭这个 issue 。
Closes #234
也可以一次关闭多个 issue 。
Closes #123, #245, #992
Revert
还有一种特殊情况,如果当前 commit 用于撤销以前的 commit,则必须以revert:开头,后面跟着被撤销 Commit 的 Header。
revert: feat(pencil): add 'graphiteWidth' option
This reverts commit 667ecc1654a317a13331b17617d973392f415f02.
Body部分的格式是固定的,必须写成This reverts commit <hash>.,其中的hash是被撤销 commit 的 SHA 标识符。
如果当前 commit 与被撤销的 commit,在同一个发布(release)里面,那么它们都不会出现在 Change log 里面。如果两者在不同的发布,那么当前 commit,会出现在 Change log 的Reverts小标题下面。
Citation:
References: