如何成为 ASF 的 Committer

关于本文

 本文主要是为了,记录给 Apache Druid / Apache Eagle / Apache Flink / Apache HBase / Apache Kafka / Apache Superset / Apache Zookeeper & Apache Curator / TensorFlow / Alibaba DataX 开源社区贡献代码,尽自己一点绵薄之力的过程

 文章最后,总结了一些经验之谈,期冀能帮助到同样热爱开源、也想成为 Committer 的小伙伴们

开源贡献纪实

Apache / Druid

Pull Request

TitleStatusCreate DateMerge Date
Some code refactor for better performance of Avro-Extension #4092Merged2017-03-222017-04-25
Explain Avro´s unnecessary EOFException (#4098) #4100Merged2017-03-232017-03-24
Improve collection related things that reusing a immutable object instead of creating a new object #4135Merged2017-03-302017-05-17
Increment the resource of JVM and the number of threads in Travis instead of default #4139Closed2017-03-31
Update outdated RLE paper and improve some code refactoring #4286Merged2017-05-172017-05-19
Fix bug in SegmentAnalyzer.analyzeComplexColumn() #5939 #5954Merged2018-07-072018-07-10
Remove redundant type parameters and enforce some other style and inspection rules #5980Merged2018-07-092018-07-28
Add IRC#druid-dev shields.io into README #6002Merged2018-07-132018-07-22
Add the ‘—fail-at-end’ option to maven command for ‘strictly compiled’ part #6078Merged2018-07-312018-08-01
Fix missing exception handling as part of io.druid.java.util.http.client.netty.HttpClientPipelineFactory #6090Merged2018-08-022018-08-11
Make time-related variables more readable #6158Merged2018-08-122018-08-22
Add maven.exec.xxx.skip option for exec-maven-plugin #6162Merged2018-08-132018-09-25
Fix assertionError at testCheckpointForInactiveTaskGroup in KafkaSupervisorTest #6192Merged2018-08-192018-08-22
Fix wrong counter getFailedSendingTimeCounter method #6793Merged2019-01-022019-01-02
In addition to special cases such as avoiding deadlock, make sure that the current thread has got the connectionLock object lock when accessing the statements object #6903Merged2019-01-232019-01-28
For performance reasons, use java.util.Base64 instead of Base64 in Apache Commons Codec and Guava #6913Merged2019-01-252019-01-26
Add “REVERSE” / “REPEAT” / “RIGHT” / “LEFT” functions #7334Merged2019-03-232019-04-10
Fix broken links in api-reference.md #7670Merged2019-04-162019-04-16
Bump httpcore from 4.4.4 to 4.4.11 #7870Merged2019-06-122019-08-10
Optimize images by ImgBot #7873Merged2019-06-122019-06-25
Bump jmh from 1.19 to 1.21 #7876Merged2019-06-132019-06-17
Bump RoaringBitmap from 0.8.0 to 0.8.6 #7906Merged2019-06-172019-06-17
Bump commons-cli from 1.2 to 1.3.1 #7966Merged2019-06-262019-06-26
Bump jaxb-api from 2.3.0 to 2.3.1 #7978Merged2019-06-272019-06-27
Bump commons-validator from 1.4.0 to 1.5.1 #7987Merged2019-06-282019-06-28
Bump commons-codec from 1.7 to 1.12 #7995Merged2019-06-292019-06-29
Bump rhino from 1.7R5 to 1.7.11 #8008Merged2019-07-022019-08-10
Bump JUnitParams from 1.0.4 to 1.1.1 #8017Open2019-07-03
Hide descriptive comments in pull_request_template.md #8313Merged2019-08-152019-08-16

Issues

All issues in Druid
Open / Close / Total : 0 / 5 / 5


Apache / Eagle

Pull Request

TitleStatusCreate DateMerge Date
[EAGLE-981] GC overhead limit exceeded #896Merged2017-03-302017-04-18
[EAGLE-982] The log length has exceeded the limit of 4 MB in Travis #897Merged2017-03-302017-04-18
[EAGLE-992] HBase Naming that unify Hbase and HBase into HBase#905Merged2017-04-062017-04-18
[EAGLE-1009] Fix return inside finally block may result in losing exception #920Merged2017-04-182017-04-19
[MINOR] Fix some project construction problems about test sources #922Closed2017-04-19
[EAGLE-1012] Some language level problems #925Closed2017-04-19
[MINOR] Fxi sprk/egle issues in JPM module #943Closed2017-06-07

Issues

All issues in Eagle
Open / Close / Total : 4 / 5 / 9


Pull Request

TitleStatusCreate DateMerge Date
FLINK-6868[build] Using scala.binary.version for flink-streaming-scala in Cassandra Connector #4087Merged2017-06-082017-06-25
FLINK-7369: Add more information for Key group index out of range of key group range exception #4474Merged2017-08-042017-08-04

Issues

All issues in Flink
Open / Close / Total : 0 / 3 / 3

Tips: How to Contribute to Flink


Apache / Flume

Pull Request

TitleStatusCreate DateMerge Date
Using volatile + ConcurrentHashMap + LongAdder instead of syncrhonzied + HashMap + AtomicLong for CounterGroup #194Open2018-01-17

Tips: How to Contribute to Flume


Apache / HBase

Pull Request

TitleStatusCreate DateMerge Date
HBASE-18470: Fix a bug in RetriesExhaustedWithDetailsException#getDesc describe#56Merged2017-07-282017-08-03

Apache / Kafka

Pull Request

TitleStatusCreate DateMerge Date
[MINOR] Improve runtime / storage / metrics / config parts #4525Merged2018-02-052018-02-14
MINOR: Catch null pointer exception for empty leader URL when assignment is null #4798Merged2018-03-302018-11-17
MINOR: Remove magic number and extract Pattern instance from method as class field #4799Merged2018-03-302018-04-09

Landoop / Kafka-Connect-UI

Pull Request

TitleStatusCreate DateMerge Date
Fix #69 Cannot parse automatically the right configurations in PROPERTIES mode when we create a new connector #70Merged2018-03-132018-03-16
Add new feature: restart task #72Merged2018-03-162018-03-21

Issues

All issues in Kafka-Connect-UI


Apache / Phoenix

Pull Request

TitleStatusCreate DateMerge Date
PHOENIX-3961 Should delete tableOutputPath in completebulkload #264Closed2017-06-20

Apache / Superset

Pull Request

TitleStatusCreate DateMerge Date
little code refactor in models.py #2124Merged2017-02-072017-02-07
Fix werkzeug instance was created twice in Debug Mode (#2135) #2136Merged2017-02-082017-02-14
Fix ExtDeprecationWarning (#2137) #2138Merged2017-02-082017-02-09
Some code refactoring #2139Merged2017-02-082017-02-09
Using the time zone with specific name for querying Druid #2143Merged2017-02-092017-02-10
Aggregate data outside of topN into a single category #2176Closed2017-02-15
Fix UNKNOWN option in setup.py #2199Closed2017-02-17
fix timezone issues in slices (#2354) #2370Closed2017-03-08
Fix unicode issues (#2308 #2282) #2401Merged2017-03-142017-03-15
Fix rst grammar problems #4116Merged2017-12-262017-12-26
Fix invaild gitter url #4125Merged2017-12-272018-01-05
Hanization #4126Merged2017-12-272018-01-13

Issues

All issues in Superset
Open / Close / Total : 0 / 21 / 21


Apache / Zookeeper

Pull Request

TitleStatusCreate DateMerge Date
ZOOKEEPER-2784: Add same sid config problem check #257Closed2017-05-18
ZOOKEEPER-2789: Reassign ZXID for solving 32bit overflow problem #262Open2017-05-23
ZOOKEEPER-2815: 1. Using try clause to close resource; 2. Others code refactoring for PERSISTENCE module #283Merged2017-06-162017-06-26
ZOOKEEPER-2816: Code refactoring for ZK_SERVER module #288Merged2017-06-202017-06-26
ZOOKEEPER-2817: Using Collections.singletonList instead of Arrays.asList(oneElement) #290Closed2017-06-22
ZOOKEEPER-2821: 1. Fix spell issues; 2. Remove unnecessary boxing / unboxing; 3. Simplify return clause; 4. … #293Closed2017-06-27
ZOOKEEPER-2822: Wrong ObjectName about MBeanServer in JMX module #294Merged2017-06-272018-11-27
ZOOKEEPER-2823: 1. Fix spell issues; 2. Standardize StringBuilder#append usage; 3. Using try clause for … #295Closed2017-06-28
ZOOKEEPER-2824: FileChannel#size info should be added to FileTxnLog#commit to solve the confuse that reason is too large log or too busy disk I/O #296Merged2017-06-282018-02-02
ZOOKEEPER-2825: 1. Remove unnecessary import; 2. contains instead of indexOf > -1 for more readable … #297Merged2017-06-292018-01-31
ZOOKEEPER-2826: Code refactoring for CLI module #298Merged2017-06-292018-01-31
ZOOKEEPER-2835: Run server with -XX:+AlwaysPreTouch jvm flag #301Closed2017-07-04
ZOOKEEPER-2837: Add a special START_SERVER_JVMFLAGS option only for start command to distinguish … #302Closed2017-07-04
ZOOKEEPER-2840: Should using System.nanoTime() ^ this.hashCode() for StaticHostProvider #303Open2017-07-05
ZOOKEEPER-2892: Improve lazy initialize and close stream for PrepRequestProcessor #361Merged2017-09-062018-02-07

Issues

All issues in Zookeeper
Open / Close / Total : 10 / 8 / 18


Apache / Curator

Pull Request

TitleStatusCreate DateMerge Date
CURATOR-523: Fix ByteBuffer’s compatibility issues #321Open2019-08-01

Tensorflow / Tensorflow

Pull Request

TitleStatusCreate DateMerge Date
Add .idea/** into .gitignore for JetBrains IDE #12094Merged2017-08-082017-08-10

Alibaba / DataX

Pull Request

TitleStatusCreate DateMerge Date
Add OpenTSDB reader and TSDB writer #328Merged2019-04-262019-04-26
Add OpenTSDB reader and TSDB writer into README.md #329Merged2019-04-262019-04-26

初衷

 需要提前说明的是,大家不能为了成为 Committer 而去成为 Committer。我们的初衷应该是认可开源,热爱开源,乐于和全球的开发者一起努力,做出来一些有意义的东西。换句话说,如果一行代码都还没贡献,就开始到处找攻略或捷径,则是很不可取的。当然有这个目标是很好的,但是正常情况下,成为 Committer 不是一蹴而就的事情。需要我们付出足够多的心力和汗水之后,才会水到渠成地收到来自 ASF 的邀请函。

技巧

 如果说成为 Committer 这件事完全没有任何技巧,也是不可能的。下面就来说一些大家需要注意的事项,尽量地少走弯路:

选择项目

 第一步当然是寻找一个合适自己的项目,能和自己的兴趣或工作内容相关的项目,自然是最好不过了。另外,也要从是否有商业公司在背后主导,是否有长期活跃的 Committer,是否具备和其他同类产品的核心竞争力,是否在架构上存在重大缺陷,是否对新代码贡献者很包容 等等角度来判断,这个项目是否值得你去付出大量的精力。

代码贡献

 按理说,任何的代码提交,都已经先建立 issues 发起一次讨论。一方面,可以让社区里的其他代码贡献者,知道你想要做什么样的事情;另一方面,也可以听取其他人的意见,包括你要做的这件事的必要性,以及是否有其他更好的实现思路。如果刚开始对某一个项目进行代码贡献,则可以从认领一些 issues 来开始。比较好的开源项目,还会在 issues 上打上类似 Contributions Welcome 的标签。

代码评审

 很多小伙伴会认为只有 Committer 才能对其他人的代码进行 review。其实不然,任何你想到的有价值的意见,都可以提出来。并且,在帮助评审他人代码的同时,还能学习到别人解决问题的方式方法。尤其是在一些有争议的地方,可以看到不同的贡献者,针对同一个问题从不同角度的思考,对自己的思维开拓也是大有裨益的。

代码提交的几个注意点

通用技巧

保持 Diff 信息最简

 PR 中不应该做无关的 Code Format(import / 代码缩进 等)

保持 PR 的相关性

 不做无关的 代码优化,尤其是对其他不相关的类(可以另起 PR 进行优化)

保持 代码风格一致

 关闭 IDE 自动优化 import 合并为通配符 * 的功能(如,import java.io.* 等)

因地制宜

Apache Druid

 遵照 Apache Druid 编码规则,比如 参数列表,需要分行写 等

Apache Eagle

 Apache Eagle 需要 squash PR 中的 commits 等等

Apache HBase

 Apache HBase 是以 Patch + Jira 为主的代码维护模式,Github 里面只是代码镜像,所以提交代码不需要创建 PR

Apache Superset

 Apache Superset / Tensorflow 之类的 Python 项目,需要注意 PEP 规范

Apache Zookeeper

 参照官方给出的提交代码的文档即可 How to Contribute to Zookeeper

好的习惯

  • 在提交之前,先更新 master 分支,并通过 git rebase -i master 命令,将自己的提交置顶(主分支,也可能不叫 master,比如 Kafka 的主分支是 trunk)
  • 保证自己的代码,能够被单元测试覆盖到。如果原本的测试用例,无法覆盖到,则需要自己编写对应的单元测试
  • 提交性能提升型 PR,需要自己写好 benchmark,并贴出压测结果
  • 提交 PR 的时候,在标题的前面增加 [JIRA](对应的 Jira 号)、[MINOR](微小的改动)、[WIP](未完成的修改)和 [Benchmarking](性能测试中) 之类的标示,可以帮助 Committer 更高效地处理 PR

Tips: 关于 Git 的相关操作,详见我的另一篇博客:《Git 高级玩法

那么成为 ASF Committer 有什么好处?

  • 可以拥有一个 @apache.org 的邮箱

  • 在任何一个 Apache 项目中发言都将标识 Member 徽章

  • 可以免费使用 IDEA 全家桶中的所有产品

    JetBrains All Products Pack license for ASF Committers

    (对 IntelliJ IDEA™ 的截图)

欢迎加入我们的技术群,一起交流学习

人工智能 (高级)& (进阶)| BigData | 算法

Benedict Jin wechat
Subscribe to my blog by scanning my public wechat account.