Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C29BF19643 for ; Thu, 24 Mar 2016 15:54:56 +0000 (UTC) Received: (qmail 72071 invoked by uid 500); 24 Mar 2016 15:54:45 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 72022 invoked by uid 500); 24 Mar 2016 15:54:45 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 68659 invoked by uid 99); 24 Mar 2016 15:54:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Mar 2016 15:54:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9C6C8E980B; Thu, 24 Mar 2016 15:54:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: misty@apache.org To: commits@hbase.apache.org Date: Thu, 24 Mar 2016 15:55:30 -0000 Message-Id: <120515f55c584fcfbed21812c2752474@git.apache.org> In-Reply-To: <4b92113c539c459a9ed56e402685cba1@git.apache.org> References: <4b92113c539c459a9ed56e402685cba1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [50/51] [partial] hbase-site git commit: Published site at 52fd70500e0a00e273e2ec0c09d7c914b89432ce. http://git-wip-us.apache.org/repos/asf/hbase-site/blob/f30982bd/apidocs/src-html/org/apache/hadoop/hbase/filter/TimestampsFilter.html ---------------------------------------------------------------------- diff --git a/apidocs/src-html/org/apache/hadoop/hbase/filter/TimestampsFilter.html b/apidocs/src-html/org/apache/hadoop/hbase/filter/TimestampsFilter.html index 37f1302..a5616d0 100644 --- a/apidocs/src-html/org/apache/hadoop/hbase/filter/TimestampsFilter.html +++ b/apidocs/src-html/org/apache/hadoop/hbase/filter/TimestampsFilter.html @@ -31,163 +31,214 @@ 023import java.util.TreeSet; 024 025import org.apache.hadoop.hbase.Cell; -026import org.apache.hadoop.hbase.classification.InterfaceAudience; -027import org.apache.hadoop.hbase.classification.InterfaceStability; -028import org.apache.hadoop.hbase.exceptions.DeserializationException; -029import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; -030 -031import com.google.common.base.Preconditions; -032import com.google.protobuf.InvalidProtocolBufferException; -033 -034/** -035 * Filter that returns only cells whose timestamp (version) is -036 * in the specified list of timestamps (versions). -037 * <p> -038 * Note: Use of this filter overrides any time range/time stamp -039 * options specified using {@link org.apache.hadoop.hbase.client.Get#setTimeRange(long, long)}, -040 * {@link org.apache.hadoop.hbase.client.Scan#setTimeRange(long, long)}, {@link org.apache.hadoop.hbase.client.Get#setTimeStamp(long)}, -041 * or {@link org.apache.hadoop.hbase.client.Scan#setTimeStamp(long)}. -042 */ -043@InterfaceAudience.Public -044@InterfaceStability.Stable -045public class TimestampsFilter extends FilterBase { -046 -047 TreeSet<Long> timestamps; -048 private static final int MAX_LOG_TIMESTAMPS = 5; -049 -050 // Used during scans to hint the scan to stop early -051 // once the timestamps fall below the minTimeStamp. -052 long minTimeStamp = Long.MAX_VALUE; -053 -054 /** -055 * Constructor for filter that retains only those -056 * cells whose timestamp (version) is in the specified -057 * list of timestamps. -058 * -059 * @param timestamps -060 */ -061 public TimestampsFilter(List<Long> timestamps) { -062 for (Long timestamp : timestamps) { -063 Preconditions.checkArgument(timestamp >= 0, "must be positive %s", timestamp); -064 } -065 this.timestamps = new TreeSet<Long>(timestamps); -066 init(); -067 } -068 -069 /** -070 * @return the list of timestamps -071 */ -072 public List<Long> getTimestamps() { -073 List<Long> list = new ArrayList<Long>(timestamps.size()); -074 list.addAll(timestamps); -075 return list; -076 } -077 -078 private void init() { -079 if (this.timestamps.size() > 0) { -080 minTimeStamp = this.timestamps.first(); -081 } +026import org.apache.hadoop.hbase.CellUtil; +027import org.apache.hadoop.hbase.classification.InterfaceAudience; +028import org.apache.hadoop.hbase.classification.InterfaceStability; +029import org.apache.hadoop.hbase.exceptions.DeserializationException; +030import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; +031 +032import com.google.common.base.Preconditions; +033import com.google.protobuf.InvalidProtocolBufferException; +034 +035/** +036 * Filter that returns only cells whose timestamp (version) is +037 * in the specified list of timestamps (versions). +038 * <p> +039 * Note: Use of this filter overrides any time range/time stamp +040 * options specified using {@link org.apache.hadoop.hbase.client.Get#setTimeRange(long, long)}, +041 * {@link org.apache.hadoop.hbase.client.Scan#setTimeRange(long, long)}, {@link org.apache.hadoop.hbase.client.Get#setTimeStamp(long)}, +042 * or {@link org.apache.hadoop.hbase.client.Scan#setTimeStamp(long)}. +043 */ +044@InterfaceAudience.Public +045@InterfaceStability.Stable +046public class TimestampsFilter extends FilterBase { +047 +048 private final boolean canHint; +049 TreeSet<Long> timestamps; +050 private static final int MAX_LOG_TIMESTAMPS = 5; +051 +052 // Used during scans to hint the scan to stop early +053 // once the timestamps fall below the minTimeStamp. +054 long minTimeStamp = Long.MAX_VALUE; +055 +056 /** +057 * Constructor for filter that retains only the specified timestamps in the list. +058 * @param timestamps +059 */ +060 public TimestampsFilter(List<Long> timestamps) { +061 this(timestamps, false); +062 } +063 +064 /** +065 * Constructor for filter that retains only those +066 * cells whose timestamp (version) is in the specified +067 * list of timestamps. +068 * +069 * @param timestamps list of timestamps that are wanted. +070 * @param canHint should the filter provide a seek hint? This can skip +071 * past delete tombstones, so it should only be used when that +072 * is not an issue ( no deletes, or don't care if data +073 * becomes visible) +074 */ +075 public TimestampsFilter(List<Long> timestamps, boolean canHint) { +076 for (Long timestamp : timestamps) { +077 Preconditions.checkArgument(timestamp >= 0, "must be positive %s", timestamp); +078 } +079 this.canHint = canHint; +080 this.timestamps = new TreeSet<Long>(timestamps); +081 init(); 082 } 083 084 /** -085 * Gets the minimum timestamp requested by filter. -086 * @return minimum timestamp requested by filter. -087 */ -088 public long getMin() { -089 return minTimeStamp; -090 } -091 -092 @Override -093 public boolean filterRowKey(Cell cell) throws IOException { -094 // Impl in FilterBase might do unnecessary copy for Off heap backed Cells. -095 return false; -096 } -097 -098 @Override -099 public ReturnCode filterKeyValue(Cell v) { -100 if (this.timestamps.contains(v.getTimestamp())) { -101 return ReturnCode.INCLUDE; -102 } else if (v.getTimestamp() < minTimeStamp) { -103 // The remaining versions of this column are guaranteed -104 // to be lesser than all of the other values. -105 return ReturnCode.NEXT_COL; -106 } -107 return ReturnCode.SKIP; -108 } -109 -110 public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) { -111 ArrayList<Long> timestamps = new ArrayList<Long>(); -112 for (int i = 0; i<filterArguments.size(); i++) { -113 long timestamp = ParseFilter.convertByteArrayToLong(filterArguments.get(i)); -114 timestamps.add(timestamp); -115 } -116 return new TimestampsFilter(timestamps); -117 } -118 -119 /** -120 * @return The filter serialized using pb -121 */ -122 public byte [] toByteArray() { -123 FilterProtos.TimestampsFilter.Builder builder = -124 FilterProtos.TimestampsFilter.newBuilder(); -125 builder.addAllTimestamps(this.timestamps); -126 return builder.build().toByteArray(); -127 } -128 -129 /** -130 * @param pbBytes A pb serialized {@link TimestampsFilter} instance -131 * @return An instance of {@link TimestampsFilter} made from <code>bytes</code> -132 * @throws DeserializationException -133 * @see #toByteArray -134 */ -135 public static TimestampsFilter parseFrom(final byte [] pbBytes) -136 throws DeserializationException { -137 FilterProtos.TimestampsFilter proto; -138 try { -139 proto = FilterProtos.TimestampsFilter.parseFrom(pbBytes); -140 } catch (InvalidProtocolBufferException e) { -141 throw new DeserializationException(e); -142 } -143 return new TimestampsFilter(proto.getTimestampsList()); -144 } -145 -146 /** -147 * @param other -148 * @return true if and only if the fields of the filter that are serialized -149 * are equal to the corresponding fields in other. Used for testing. -150 */ -151 boolean areSerializedFieldsEqual(Filter o) { -152 if (o == this) return true; -153 if (!(o instanceof TimestampsFilter)) return false; -154 -155 TimestampsFilter other = (TimestampsFilter)o; -156 return this.getTimestamps().equals(other.getTimestamps()); +085 * @return the list of timestamps +086 */ +087 public List<Long> getTimestamps() { +088 List<Long> list = new ArrayList<Long>(timestamps.size()); +089 list.addAll(timestamps); +090 return list; +091 } +092 +093 private void init() { +094 if (this.timestamps.size() > 0) { +095 minTimeStamp = this.timestamps.first(); +096 } +097 } +098 +099 /** +100 * Gets the minimum timestamp requested by filter. +101 * @return minimum timestamp requested by filter. +102 */ +103 public long getMin() { +104 return minTimeStamp; +105 } +106 +107 @Override +108 public boolean filterRowKey(Cell cell) throws IOException { +109 // Impl in FilterBase might do unnecessary copy for Off heap backed Cells. +110 return false; +111 } +112 +113 @Override +114 public ReturnCode filterKeyValue(Cell v) { +115 if (this.timestamps.contains(v.getTimestamp())) { +116 return ReturnCode.INCLUDE; +117 } else if (v.getTimestamp() < minTimeStamp) { +118 // The remaining versions of this column are guaranteed +119 // to be lesser than all of the other values. +120 return ReturnCode.NEXT_COL; +121 } +122 return canHint ? ReturnCode.SEEK_NEXT_USING_HINT : ReturnCode.SKIP; +123 } +124 +125 +126 /** +127 * Pick the next cell that the scanner should seek to. Since this can skip any number of cells +128 * any of which can be a delete this can resurect old data. +129 * +130 * The method will only be used if canHint was set to true while creating the filter. +131 * +132 * @throws IOException This will never happen. +133 */ +134 public Cell getNextCellHint(Cell currentCell) throws IOException { +135 if (!canHint) { +136 return null; +137 } +138 +139 Long nextTimestampObject = timestamps.lower(currentCell.getTimestamp()); +140 +141 if (nextTimestampObject == null) { +142 // This should only happen if the current column's +143 // timestamp is below the last one in the list. +144 // +145 // It should never happen as the filterKeyValue should return NEXT_COL +146 // but it's always better to be extra safe and protect against future +147 // behavioral changes. +148 +149 return CellUtil.createLastOnRowCol(currentCell); +150 } +151 +152 // Since we know the nextTimestampObject isn't null here there must still be +153 // timestamps that can be included. Cast the Long to a long and return the +154 // a cell with the current row/cf/col and the next found timestamp. +155 long nextTimestamp = nextTimestampObject; +156 return CellUtil.createFirstOnRowColTS(currentCell, nextTimestamp); 157 } 158 -159 @Override -160 public String toString() { -161 return toString(MAX_LOG_TIMESTAMPS); -162 } -163 -164 protected String toString(int maxTimestamps) { -165 StringBuilder tsList = new StringBuilder(); -166 -167 int count = 0; -168 for (Long ts : this.timestamps) { -169 if (count >= maxTimestamps) { -170 break; -171 } -172 ++count; -173 tsList.append(ts.toString()); -174 if (count < this.timestamps.size() && count < maxTimestamps) { -175 tsList.append(", "); -176 } -177 } +159 public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) { +160 ArrayList<Long> timestamps = new ArrayList<Long>(); +161 for (int i = 0; i<filterArguments.size(); i++) { +162 long timestamp = ParseFilter.convertByteArrayToLong(filterArguments.get(i)); +163 timestamps.add(timestamp); +164 } +165 return new TimestampsFilter(timestamps); +166 } +167 +168 /** +169 * @return The filter serialized using pb +170 */ +171 public byte[] toByteArray() { +172 FilterProtos.TimestampsFilter.Builder builder = +173 FilterProtos.TimestampsFilter.newBuilder(); +174 builder.addAllTimestamps(this.timestamps); +175 builder.setCanHint(canHint); +176 return builder.build().toByteArray(); +177 } 178 -179 return String.format("%s (%d/%d): [%s]", this.getClass().getSimpleName(), -180 count, this.timestamps.size(), tsList.toString()); -181 } -182} +179 /** +180 * @param pbBytes A pb serialized {@link TimestampsFilter} instance +181 * +182 * @return An instance of {@link TimestampsFilter} made from <code>bytes</code> +183 * @see #toByteArray +184 */ +185 public static TimestampsFilter parseFrom(final byte[] pbBytes) +186 throws DeserializationException { +187 FilterProtos.TimestampsFilter proto; +188 try { +189 proto = FilterProtos.TimestampsFilter.parseFrom(pbBytes); +190 } catch (InvalidProtocolBufferException e) { +191 throw new DeserializationException(e); +192 } +193 return new TimestampsFilter(proto.getTimestampsList(), +194 proto.hasCanHint() && proto.getCanHint()); +195 } +196 +197 /** +198 * @param other +199 * @return true if and only if the fields of the filter that are serialized +200 * are equal to the corresponding fields in other. Used for testing. +201 */ +202 boolean areSerializedFieldsEqual(Filter o) { +203 if (o == this) return true; +204 if (!(o instanceof TimestampsFilter)) return false; +205 +206 TimestampsFilter other = (TimestampsFilter)o; +207 return this.getTimestamps().equals(other.getTimestamps()); +208 } +209 +210 @Override +211 public String toString() { +212 return toString(MAX_LOG_TIMESTAMPS); +213 } +214 +215 protected String toString(int maxTimestamps) { +216 StringBuilder tsList = new StringBuilder(); +217 +218 int count = 0; +219 for (Long ts : this.timestamps) { +220 if (count >= maxTimestamps) { +221 break; +222 } +223 ++count; +224 tsList.append(ts.toString()); +225 if (count < this.timestamps.size() && count < maxTimestamps) { +226 tsList.append(", "); +227 } +228 } +229 +230 return String.format("%s (%d/%d): [%s] canHint: [%b]", this.getClass().getSimpleName(), +231 count, this.timestamps.size(), tsList.toString(), canHint); +232 } +233} http://git-wip-us.apache.org/repos/asf/hbase-site/blob/f30982bd/apidocs/src-html/org/apache/hadoop/hbase/snapshot/ExportSnapshot.html ---------------------------------------------------------------------- diff --git a/apidocs/src-html/org/apache/hadoop/hbase/snapshot/ExportSnapshot.html b/apidocs/src-html/org/apache/hadoop/hbase/snapshot/ExportSnapshot.html index 14327de..0a8e897 100644 --- a/apidocs/src-html/org/apache/hadoop/hbase/snapshot/ExportSnapshot.html +++ b/apidocs/src-html/org/apache/hadoop/hbase/snapshot/ExportSnapshot.html @@ -1065,11 +1065,11 @@ 1057 System.err.println(" -bandwidth Limit bandwidth to this value in MB/second."); 1058 System.err.println(); 1059 System.err.println("Examples:"); -1060 System.err.println(" hbase " + getClass().getName() + " \\"); +1060 System.err.println(" hbase snapshot export \\"); 1061 System.err.println(" -snapshot MySnapshot -copy-to hdfs://srv2:8082/hbase \\"); 1062 System.err.println(" -chuser MyUser -chgroup MyGroup -chmod 700 -mappers 16"); 1063 System.err.println(); -1064 System.err.println(" hbase " + getClass().getName() + " \\"); +1064 System.err.println(" hbase snapshot export \\"); 1065 System.err.println(" -snapshot MySnapshot -copy-from hdfs://srv2:8082/hbase \\"); 1066 System.err.println(" -copy-to hdfs://srv1:50070/hbase \\"); 1067 System.exit(1); http://git-wip-us.apache.org/repos/asf/hbase-site/blob/f30982bd/apidocs/src-html/org/apache/hadoop/hbase/snapshot/SnapshotInfo.html ---------------------------------------------------------------------- diff --git a/apidocs/src-html/org/apache/hadoop/hbase/snapshot/SnapshotInfo.html b/apidocs/src-html/org/apache/hadoop/hbase/snapshot/SnapshotInfo.html index dc0de15..2662234 100644 --- a/apidocs/src-html/org/apache/hadoop/hbase/snapshot/SnapshotInfo.html +++ b/apidocs/src-html/org/apache/hadoop/hbase/snapshot/SnapshotInfo.html @@ -475,7 +475,7 @@ 467 } 468 469 private void printUsageAndExit() { -470 System.err.printf("Usage: bin/hbase %s [options]%n", getClass().getName()); +470 System.err.printf("Usage: bin/hbase snapshot info [options]%n"); 471 System.err.println(" where [options] are:"); 472 System.err.println(" -h|-help Show this help and exit."); 473 System.err.println(" -remote-dir Root directory that contains the snapshots."); @@ -487,7 +487,7 @@ 479 System.err.println(" -schema Describe the snapshotted table."); 480 System.err.println(); 481 System.err.println("Examples:"); -482 System.err.println(" hbase " + getClass() + " \\"); +482 System.err.println(" hbase snapshot info \\"); 483 System.err.println(" -snapshot MySnapshot -files"); 484 System.exit(1); 485 } http://git-wip-us.apache.org/repos/asf/hbase-site/blob/f30982bd/book.html ---------------------------------------------------------------------- diff --git a/book.html b/book.html index bcc451c..9893165 100644 --- a/book.html +++ b/book.html @@ -33282,7 +33282,7 @@ The server will return cellblocks compressed using this same compressor as long http://git-wip-us.apache.org/repos/asf/hbase-site/blob/f30982bd/bulk-loads.html ---------------------------------------------------------------------- diff --git a/bulk-loads.html b/bulk-loads.html index 08f910a..b7e5c24 100644 --- a/bulk-loads.html +++ b/bulk-loads.html @@ -7,7 +7,7 @@ - + Apache HBase – Bulk Loads in Apache HBase (TM) @@ -305,7 +305,7 @@ under the License. --> <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved. - <li id="publishDate" class="pull-right">Last Published: 2016-03-23</li> + <li id="publishDate" class="pull-right">Last Published: 2016-03-24</li> </p> </div>