Skip to content

Commit 803265d

Browse files
committed
Merge pull request #1 from apache/master
update from apache
2 parents 451798c + 9102547 commit 803265d

File tree

528 files changed

+9231
-2971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

528 files changed

+9231
-2971
lines changed

bin/hbase.cmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ if "%servercommand%" == "true" (
239239
if defined service_entry (
240240
set HBASE_LOG_PREFIX=hbase-%hbase-command%-%COMPUTERNAME%
241241
set HBASE_LOGFILE=!HBASE_LOG_PREFIX!.log
242-
set HBASE_ROOT_LOGGER=INFO,DRFA
242+
if not defined HBASE_ROOT_LOGGER (
243+
set HBASE_ROOT_LOGGER=INFO,DRFA
244+
)
243245
set HBASE_SECURITY_LOGGER=INFO,DRFAS
244246
set loggc=!HBASE_LOG_DIR!\!HBASE_LOG_PREFIX!.gc
245247
set loglog=!HBASE_LOG_DIR!\!HBASE_LOGFILE!

dev-support/make_patch.sh

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
#!/bin/bash
2+
#/**
3+
# * Licensed to the Apache Software Foundation (ASF) under one
4+
# * or more contributor license agreements. See the NOTICE file
5+
# * distributed with this work for additional information
6+
# * regarding copyright ownership. The ASF licenses this file
7+
# * to you under the Apache License, Version 2.0 (the
8+
# * "License"); you may not use this file except in compliance
9+
# * with the License. You may obtain a copy of the License at
10+
# *
11+
# * http://www.apache.org/licenses/LICENSE-2.0
12+
# *
13+
# * Unless required by applicable law or agreed to in writing, software
14+
# * distributed under the License is distributed on an "AS IS" BASIS,
15+
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# * See the License for the specific language governing permissions and
17+
# * limitations under the License.
18+
# */
19+
20+
# Make a patch for the current branch based on its tracking branch
21+
22+
# Process args
23+
while getopts "ahd:" opt; do
24+
case "$opt" in
25+
a) addendum='-addendum'
26+
;;
27+
d)
28+
patch_dir=$OPTARG
29+
;;
30+
*)
31+
echo -e "Usage: $0 [-h] [-a] [-d] <directory> \n\
32+
Must be run from within the git branch to make the patch against.\n\
33+
-h - display these instructions.\n\
34+
-a - Add an 'addendum' prefix to the patch name.\n\
35+
-d - specify a patch directory (defaults to ~/patches/)"
36+
exit 0
37+
;;
38+
esac
39+
done
40+
41+
# Find what branch we are on
42+
branch=$(git branch |grep '*' |awk '{print $2}')
43+
if [ ! "$branch" ]; then
44+
echo "Can't determine the git branch. Exiting." >&2
45+
exit 1
46+
fi
47+
48+
# Exit if git status is dirty
49+
git_dirty=$(git diff --shortstat 2> /dev/null | wc -l|awk {'print $1'})
50+
echo "git_dirty is $git_dirty"
51+
if [ "$git_dirty" -ne 0 ]; then
52+
echo "Git status is dirty. Commit locally first.">&2
53+
exit 1
54+
fi
55+
56+
# Determine the tracking branch
57+
git log -n 1 origin/$branch > /dev/null 2>&1
58+
status=$?
59+
if [ "$status" -eq 128 ]; then
60+
# Status 128 means there is no remote branch
61+
tracking_branch='origin/master'
62+
elif [ "$status" -eq 0 ]; then
63+
# Status 0 means there is a remote branch
64+
tracking_branch="origin/$branch"
65+
else
66+
echo "Unknown error: $?" >&2
67+
exit 1
68+
fi
69+
70+
# Deal with invalid or missing $patch_dir
71+
if [ ! "$patch_dir" ]; then
72+
echo -e "Patch directory not specified. Falling back to ~/patches/."
73+
patch_dir=~/patches
74+
fi
75+
76+
if [ ! -d "$patch_dir" ]; then
77+
echo "$patch_dir does not exist. Creating it."
78+
mkdir $patch_dir
79+
fi
80+
81+
# Determine what to call the patch
82+
# Check to see if any patch exists that includes the branch name
83+
status=$(ls $patch_dir/*$branch* 2>/dev/null|grep -v addendum|wc -l|awk {'print $1'})
84+
if [ "$status" -eq 0 ]; then
85+
# This is the first patch we are making for this release
86+
prefix=''
87+
elif [ "$status" -ge 1 ]; then
88+
# At least one patch already exists -- add a version prefix
89+
for i in {1..99}; do
90+
# Check to see the maximum version of patch that exists
91+
if [ ! -f "$patch_dir/$branch-v$i.patch" ]; then
92+
version=$i
93+
if [ -n "$addendum" ]; then
94+
# Don't increment the patch # if it is an addendum
95+
echo "Creating an addendum"
96+
if [ "$version" -eq 1 ]; then
97+
# We are creating an addendum to the first version of the patch
98+
prefix=''
99+
else
100+
# We are making an addendum to a different version of the patch
101+
let version=$version-1
102+
prefix="-v$version"
103+
fi
104+
else
105+
prefix="-v$version"
106+
fi
107+
break
108+
fi
109+
done
110+
fi
111+
112+
patch_name="$branch$prefix$addendum.patch"
113+
114+
# Do we need to make a diff?
115+
git diff --quiet $tracking_branch
116+
status=$?
117+
if [ "$status" -eq 0 ]; then
118+
echo "There is no difference between $branch and $tracking_branch."
119+
echo "No patch created."
120+
exit 0
121+
fi
122+
123+
# Check whether we need to squash or not
124+
local_commits=$(git log $tracking_branch..$branch|grep 'Author:'|wc -l|awk {'print $1'})
125+
if [ "$local_commits" -gt 1 ]; then
126+
read -p "$local_commits commits exist only in your local branch. Interactive rebase?" yn
127+
case $yn in
128+
[Yy]* )
129+
git rebase -i $tracking_branch
130+
;;
131+
[Nn]* )
132+
echo "Creating $patch_dir/$patch_name using git diff."
133+
git diff $tracking_branch > $patch_dir/$patch_name
134+
exit 0
135+
;;
136+
esac
137+
fi
138+
139+
echo "Creating patch $patch_dir/$patch_name using git format-patch"
140+
git format-patch --stdout $tracking_branch > $patch_dir/$patch_name
141+
142+
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
#!/bin/bash
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# This script assumes that your remote is called "origin"
16+
# and that your local master branch is called "master".
17+
# I am sure it could be made more abstract but these are the defaults.
18+
19+
# Edit this line to point to your default directory,
20+
# or always pass a directory to the script.
21+
22+
DEFAULT_DIR="EDIT_ME"
23+
24+
function print_usage {
25+
cat << __EOF
26+
27+
$0: A script to manage your Apache HBase Git repository.
28+
29+
If run with no arguments, it reads the DEFAULT_DIR variable, which you
30+
can specify by editing the script.
31+
32+
Usage: $0 [-d <dir>]
33+
$0 -h
34+
35+
-h Show this screen.
36+
-d <dir> The absolute or relative directory of your Git repository.
37+
__EOF
38+
}
39+
40+
function get_all_branches {
41+
# Gets all git branches present locally
42+
all_branches=()
43+
for i in `git branch --list | sed -e "s/\*//g"`; do
44+
all_branches+=("$(echo $i | awk '{print($1)}')")
45+
done
46+
}
47+
48+
function get_tracking_branches {
49+
# Gets all branches with a remote tracking branch
50+
tracking_branches=()
51+
for i in `git branch -lvv | grep "\[origin/" | sed -e 's/\*//g' | awk {'print $1'}`; do
52+
tracking_branches+=("$(echo $i | awk '{print($1)}')")
53+
done
54+
}
55+
56+
function check_git_branch_status {
57+
# Checks the current Git branch to see if it's dirty
58+
# Returns 1 if the branch is dirty
59+
git_dirty=$(git diff --shortstat 2> /dev/null | wc -l|awk {'print $1'})
60+
if [ "$git_dirty" -ne 0 ]; then
61+
echo "Git status is dirty. Commit locally first." >&2
62+
exit 1
63+
fi
64+
}
65+
66+
function get_jira_status {
67+
# This function expects as an argument the JIRA ID,
68+
# and returns 99 if resolved and 1 if it couldn't
69+
# get the status.
70+
71+
# The JIRA status looks like this in the HTML:
72+
# span id="resolution-val" class="value resolved" >
73+
# The following is a bit brittle, but filters for lines with
74+
# resolution-val returns 99 if it's resolved
75+
jira_url='https://issues.apache.org/jira/browse'
76+
jira_id="$1"
77+
status="$(curl -s $jira_url/$jira_id | \
78+
grep resolution-val | \
79+
sed -e "s/.*class=\"value\ //" | \
80+
cut -d'"' -f 1)"
81+
if [ $? -ne 0 ]; then
82+
echo "Could not get JIRA status. Check your network." >&2
83+
exit 1
84+
fi
85+
if [ "$status" = "resolved" ]; then
86+
return 99
87+
fi
88+
}
89+
90+
# Process the arguments
91+
while getopts ":hd:" opt; do
92+
case $opt in
93+
d)
94+
# A directory was passed in
95+
dir="$OPTARG"
96+
if [ ! -d "$dir/.git/" ]; then
97+
echo "$dir does not exist or is not a Git repository." >&2
98+
exit 1
99+
fi
100+
;;
101+
h)
102+
# Print usage instructions
103+
print_usage
104+
exit 0
105+
;;
106+
*)
107+
echo "Invalid argument: $OPTARG" >&2
108+
print_usage >&2
109+
exit 1
110+
;;
111+
esac
112+
done
113+
114+
if [ -z "$dir" ]; then
115+
# No directory was passed in
116+
dir="$DEFAULT_DIR"
117+
if [ "$dir" = "EDIT_ME" ]; then
118+
echo "You need to edit the DEFAULT_DIR in $0." >&2
119+
$0 -h
120+
exit 1
121+
elif [ ! -d "$DEFAULT_DIR/.git/" ]; then
122+
echo "Default directory $DEFAULT_DIR is not a Git repository." >&2
123+
exit 1
124+
fi
125+
fi
126+
127+
cd "$dir"
128+
129+
# For each tracking branch, check it out and make sure it's fresh
130+
# This function creates tracking_branches array and stores the tracking branches in it
131+
get_tracking_branches
132+
for i in "${tracking_branches[@]}"; do
133+
git checkout -q "$i"
134+
# Exit if git status is dirty
135+
check_git_branch_status
136+
git pull -q --rebase
137+
status=$?
138+
if [ "$status" -ne 0 ]; then
139+
echo "Unable to pull changes in $i: $status Exiting." >&2
140+
exit 1
141+
fi
142+
echo "Refreshed $i from remote."
143+
done
144+
145+
# Run the function to get the list of all branches
146+
# The function creates array all_branches and stores the branches in it
147+
get_all_branches
148+
149+
# Declare array to hold deleted branch info
150+
deleted_branches=()
151+
152+
for i in "${all_branches[@]}"; do
153+
# Check JIRA status to see if we still need this branch
154+
# JIRA expects uppercase
155+
jira_id="$(echo $i | awk '{print toupper($0)'})"
156+
if [[ "$jira_id" == HBASE-* ]]; then
157+
# Returns 1 if the JIRA is closed, 0 otherwise
158+
get_jira_status "$jira_id"
159+
jira_status=$?
160+
if [ $jira_status -eq 99 ]; then
161+
# the JIRA seems to be resolved or is at least not unresolved
162+
deleted_branches+=("$i")
163+
fi
164+
fi
165+
166+
git checkout -q "$i"
167+
168+
# Exit if git status is dirty
169+
check_git_branch_status
170+
171+
# If this branch has a remote, don't rebase it
172+
# If it has a remote, it has a log with at least one entry
173+
git log -n 1 origin/"$i" > /dev/null 2>&1
174+
status=$?
175+
if [ $status -eq 128 ]; then
176+
# Status 128 means there is no remote branch
177+
# Try to rebase against master
178+
echo "Rebasing $i on origin/master"
179+
git rebase -q origin/master > /dev/null 2>&1
180+
if [ $? -ne 0 ]; then
181+
echo "Failed. Rolling back. Rebase $i manually."
182+
git rebase --abort
183+
fi
184+
elif [ $status -ne 0 ]; then
185+
# If status is 0 it means there is a remote branch, we already took care of it
186+
echo "Unknown error: $?" >&2
187+
exit 1
188+
fi
189+
done
190+
191+
# Offer to clean up all deleted branches
192+
for i in "${deleted_branches[@]}"; do
193+
read -p "$i's JIRA is resolved. Delete? " yn
194+
case $yn in
195+
[Yy])
196+
git branch -D $i
197+
;;
198+
*)
199+
echo "To delete it manually, run git branch -D $deleted_branches"
200+
;;
201+
esac
202+
done
203+
git checkout -q master
204+
exit 0

dev-support/test-patch.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,14 +517,18 @@ checkCheckstyleErrors() {
517517

518518
JIRA_COMMENT="$JIRA_COMMENT
519519
520-
{color:red}-1 javac{color}. The applied patch generated $patchCheckstyleErrors checkstyle errors (more than the trunk's current $trunkCheckstyleErrors errors)."
520+
{color:red}-1 checkstyle{color}. The applied patch generated $patchCheckstyleErrors checkstyle errors (more than the trunk's current $trunkCheckstyleErrors errors)."
521521
return 1
522522
fi
523523
echo "There were $patchCheckstyleErrors checkstyle errors in this patch compared to $trunkCheckstyleErrors on master."
524524
fi
525+
JIRA_COMMENT_FOOTER="Checkstyle Errors: $BUILD_URL/artifact/patchprocess/checkstyle-aggregate.html
526+
527+
$JIRA_COMMENT_FOOTER"
528+
525529
JIRA_COMMENT="$JIRA_COMMENT
526530
527-
{color:green}+1 javac{color}. The applied patch does not increase the total number of checkstyle errors"
531+
{color:green}+1 checkstyle{color}. The applied patch does not increase the total number of checkstyle errors"
528532
return 0
529533

530534
}
@@ -579,7 +583,7 @@ checkReleaseAuditWarnings () {
579583
{color:red}-1 release audit{color}. The applied patch generated $patchReleaseAuditWarnings release audit warnings (more than the trunk's current $OK_RELEASEAUDIT_WARNINGS warnings)."
580584
$GREP '\!?????' $PATCH_DIR/patchReleaseAuditWarnings.txt > $PATCH_DIR/patchReleaseAuditProblems.txt
581585
echo "Lines that start with ????? in the release audit report indicate files that do not have an Apache license header." >> $PATCH_DIR/patchReleaseAuditProblems.txt
582-
JIRA_COMMENT_FOOTER="Release audit warnings: $BUILD_URL/artifact/trunk/patchprocess/patchReleaseAuditProblems.txt
586+
JIRA_COMMENT_FOOTER="Release audit warnings: $BUILD_URL/artifact/patchprocess/patchReleaseAuditWarnings.txt
583587
$JIRA_COMMENT_FOOTER"
584588
return 1
585589
fi

0 commit comments

Comments
 (0)