forked from apache/logging-flume
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DEVNOTES
202 lines (141 loc) · 5.55 KB
/
DEVNOTES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
Flume Developer Notes
=====================
// This is in asciidoc markup
== Introduction
This is meant to be a a guide for issues that occur when building,
debugging and setting up Flume as developer.
== High level directory and file structure.
Flume uses the Maven build system and has a Maven project object model
(pom) that has many components broken down into Maven modules. Below
we describe the contents of different directories.
----
./bin/ Flume startup scripts
./conf/ Flume configuration file samples
./flume-ng-core Flume core module
./flume-ng-dist Flume distribution package module
./flume-ng-channels Flume channels modules (memory, JDBC and File)
./flume-ng-node Flume node module
./flume-ng-sinks Flume sink modules (HDFS)
----
The files exclusions in `.gitignore` are either autogenerated by Maven or Eclipse.
== Building and Testing Flume
=== Prerequisites
You need to have Apache Maven 3.x installed.
=== Using Maven
We are using Maven v3.x. The Maven build system steps through several phases
to create build artefacts. At the highest level, the phases that are relevent
to most devs are "compile" -> "test" -> "package" -> "install".
Set MAVEN_OPTS to give the Flume build enough RAM to build.
export MAVEN_OPTS="-Xms512m -Xmx1024m"
Builds
------
A development build that runs unit tests and installs to local Maven repo.
This builds and tests all plugins.
----
mvn install
----
A development build that skips the execution of unit tests.
----
mvn install -DskipTests
----
A development build that runs unit tests. (no package generation)
----
mvn test
----
A development build that runs unit tests including only specific tests
(where <TestFile> is a regex of a class name without .java or .class
or path).
----
mvn test -Dtest=<ClassRegex>
----
==== Including or excluding specific sets of tests.
We've added hooks to the maven build that will enable you to exclude
or include specific tests on a test run. This is useful for excluding
flakey tests or making a build that focuses solely upon flakey tests.
To do this we created two variables:
# test.include.pattern
# test.exclude.pattern
These variables take regular expression patterns of the files to be
included or excluded.
For the next set of examples, let's say you have flakey test called
TestFlaky1 and TestFlaky2.
You can execute tests that skip TestFlaky1 and TestFlaky2 by using the
following command line:
----
mvn test -Dtest.exclude.pattern=**/TestFlaky*.java
----
Alternately, you could be more explicit
----
mvn test -Dtest.exclude.pattern=**/TestFlaky1.java,**/TestFlaky2.java
----
Conversely, you could execute only the flaky tests by using:
----
mvn test -Dtest.include.pattern=**/TestFlaky*.java
----
You can also have a combination of imports and exports. This runs
TestFlaky* but skips over TestFlaky2:
----
mvn test -Dtest.include.pattern=**/TestFlaky*.java -Dtest.exclude.pattern=**/TestFlaky2.java
----
NOTE: Both test.exclude.pattern and test.include.pattern get
overridden if the test parameter is used. Consider:
----
mvn test -Dtest.exclude.pattern=**/TestFlaky*.java -Dtest=TestFlaky1
---
In this case, TestFlaky1 will be run despite being in the
test.exclude.pattern.
=== Running the most recent build
To run the most recent build of Flume, first build the distribuion
packages.
----
mvn install -DskipTests
----
== Integrated Development Environments for Flume
Currently most Flume developers use the Eclipse IDE. We have included
some instructions for getting started with Eclipse.
=== Setting up a Flume Eclipse projects from the Maven POMs.
If you use Eclipse we suggest you use the m2eclipse plugin available
here to properly create an environment for dev and testing in Eclipse.
http://m2eclipse.sonatype.org/
After installing it in Eclipse you will want to "Import" the Flume
pom.xml project.
This can be done by going to the Eclipse applications menu, navigating
to File > Import... > Existing Maven Projects. From there, browse to
and select the directory that contains the root of the Flume project.
== Rules of the Repository
We have a few basic rules for code in the repository.
The master/trunk pointer:
* MUST always build.
* SHOULD always pass all unit tests
When commitng code we tag pushes with JIRA numbers, and their short descriptions.
Generally these are in the following format:
----
FLUME-42: Description from the jira
----
All source files must include the following header (or a variant
depending on comment characters):
----
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
----
No build generated files should be checked in. Here are some examples
of generate files that should not be checked:
* html documentation
* avro-generated source
* auto-generated versioning annotations