HBASE-11873 Hbase Version CLI enhancement (Ashish Singhi)
This commit is contained in:
parent
9fe945f454
commit
8a7326dd45
|
@ -57,4 +57,10 @@ public @interface VersionAnnotation {
|
|||
* @return the revision number as a string (eg. "451451")
|
||||
*/
|
||||
String revision();
|
||||
|
||||
/**
|
||||
* Get a checksum of the source files from which HBase was compiled.
|
||||
* @return a string that uniquely identifies the source
|
||||
**/
|
||||
String srcChecksum();
|
||||
}
|
||||
|
|
|
@ -93,11 +93,20 @@ public class VersionInfo {
|
|||
static String[] versionReport() {
|
||||
return new String[] {
|
||||
"HBase " + getVersion(),
|
||||
"Subversion " + getUrl() + " -r " + getRevision(),
|
||||
"Compiled by " + getUser() + " on " + getDate()
|
||||
"Source code repository " + getUrl() + " -r " + getRevision(),
|
||||
"Compiled by " + getUser() + " on " + getDate(),
|
||||
"From source with checksum " + getSrcChecksum()
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the checksum of the source files from which Hadoop was compiled.
|
||||
* @return a string that uniquely identifies the source
|
||||
**/
|
||||
public static String getSrcChecksum() {
|
||||
return version != null ? version.srcChecksum() : "Unknown";
|
||||
}
|
||||
|
||||
public static void writeTo(PrintWriter out) {
|
||||
for (String line : versionReport()) {
|
||||
out.println(line);
|
||||
|
|
|
@ -41,6 +41,17 @@ else
|
|||
revision="Unknown"
|
||||
url="file://$cwd"
|
||||
fi
|
||||
which md5sum > /dev/null
|
||||
if [ "$?" != "0" ] ; then
|
||||
which md5 > /dev/null
|
||||
if [ "$?" != "0" ] ; then
|
||||
srcChecksum="Unknown"
|
||||
else
|
||||
srcChecksum=`find hbase-*/src/main/ | grep -e "\.java" -e "\.proto" | LC_ALL=C sort | xargs md5 | md5 | cut -d ' ' -f 1`
|
||||
fi
|
||||
else
|
||||
srcChecksum=`find hbase-*/src/main/ | grep -e "\.java" -e "\.proto" | LC_ALL=C sort | xargs md5sum | md5sum | cut -d ' ' -f 1`
|
||||
fi
|
||||
popd
|
||||
|
||||
mkdir -p "$outputDirectory/org/apache/hadoop/hbase"
|
||||
|
@ -49,7 +60,8 @@ cat >"$outputDirectory/org/apache/hadoop/hbase/package-info.java" <<EOF
|
|||
* Generated by src/saveVersion.sh
|
||||
*/
|
||||
@VersionAnnotation(version="$version", revision="$revision",
|
||||
user="$user", date="$date", url="$url")
|
||||
user="$user", date="$date", url="$url",
|
||||
srcChecksum="$srcChecksum")
|
||||
package org.apache.hadoop.hbase;
|
||||
EOF
|
||||
|
||||
|
|
|
@ -232,6 +232,11 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
|
|||
<td><% org.apache.hadoop.hbase.util.VersionInfo.getDate() %>, <% org.apache.hadoop.hbase.util.VersionInfo.getUser() %></td>
|
||||
<td>When HBase version was compiled and by whom</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HBase Source Checksum</td>
|
||||
<td><% org.apache.hadoop.util.VersionInfo.getSrcChecksum() %></td>
|
||||
<td>HBase source MD5 checksum</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hadoop Version</td>
|
||||
<td><% org.apache.hadoop.util.VersionInfo.getVersion() %>, r<% org.apache.hadoop.util.VersionInfo.getRevision() %></td>
|
||||
|
|
|
@ -140,6 +140,11 @@ org.apache.hadoop.hbase.zookeeper.MasterAddressTracker;
|
|||
<td><% org.apache.hadoop.hbase.util.VersionInfo.getDate() %>, <% org.apache.hadoop.hbase.util.VersionInfo.getUser() %></td>
|
||||
<td>When HBase version was compiled and by whom</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HBase Source Checksum</td>
|
||||
<td><% org.apache.hadoop.util.VersionInfo.getSrcChecksum() %></td>
|
||||
<td>HBase source MD5 checksum</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Zookeeper Quorum</td>
|
||||
<td><% regionServer.getZooKeeper().getQuorum() %></td>
|
||||
|
|
Loading…
Reference in New Issue