hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chia7...@apache.org
Subject hbase git commit: HBASE-17617 Backport HBASE-16731 (Inconsistent results from the Get/Scan if we use the empty FilterList) to branch-1
Date Thu, 17 Aug 2017 10:32:45 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 4f639e7d8 -> 509c1b63e


HBASE-17617 Backport HBASE-16731 (Inconsistent results from the Get/Scan if we use the empty
FilterList) to branch-1

Signed-off-by: Chia-Ping Tsai <chia7712@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/509c1b63
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/509c1b63
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/509c1b63

Branch: refs/heads/branch-1.2
Commit: 509c1b63ed8e051478e07f2047b9a09aec0b94ef
Parents: 4f639e7
Author: Pankaj Kumar <pankaj.kr@huawei.com>
Authored: Wed Aug 16 23:57:42 2017 +0800
Committer: Chia-Ping Tsai <chia7712@gmail.com>
Committed: Thu Aug 17 18:30:57 2017 +0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/client/Get.java     |   5 +
 .../org/apache/hadoop/hbase/client/Query.java   |  35 ++++
 .../org/apache/hadoop/hbase/client/Scan.java    |  36 +---
 .../hadoop/hbase/protobuf/ProtobufUtil.java     |   9 +-
 .../apache/hadoop/hbase/client/TestScan.java    |  32 ++++
 .../hbase/protobuf/generated/ClientProtos.java  | 173 ++++++++++++++++---
 hbase-protocol/src/main/protobuf/Client.proto   |   1 +
 .../hadoop/hbase/regionserver/HRegion.java      |   3 +
 .../hadoop/hbase/client/TestFromClientSide.java |  45 +++++
 .../hadoop/hbase/protobuf/TestProtobufUtil.java |   1 +
 10 files changed, 280 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/509c1b63/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
index 88da0b0..72ab0ed 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
@@ -110,6 +110,7 @@ public class Get extends Query
     this.storeOffset = get.getRowOffsetPerColumnFamily();
     this.tr = get.getTimeRange();
     this.checkExistenceOnly = get.isCheckExistenceOnly();
+    this.loadColumnFamiliesOnDemand = get.getLoadColumnFamiliesOnDemandValue();
     this.closestRowBefore = get.isClosestRowBefore();
     Map<byte[], NavigableSet<byte[]>> fams = get.getFamilyMap();
     for (Map.Entry<byte[],NavigableSet<byte[]>> entry : fams.entrySet()) {
@@ -241,6 +242,10 @@ public class Get extends Query
     return this;
   }
 
+  public Get setLoadColumnFamiliesOnDemand(boolean value) {
+    return (Get) super.setLoadColumnFamiliesOnDemand(value);
+  }
+
   /**
    * Set the maximum number of values to return per row per Column Family
    * @param limit the maximum number of values returned / row / CF

http://git-wip-us.apache.org/repos/asf/hbase/blob/509c1b63/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java
index 53e680d..a49623a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java
@@ -43,6 +43,7 @@ public abstract class Query extends OperationWithAttributes {
   protected int targetReplicaId = -1;
   protected Consistency consistency = Consistency.STRONG;
   protected Map<byte[], TimeRange> colFamTimeRangeMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
+  protected Boolean loadColumnFamiliesOnDemand = null;
 
   /**
    * @return Filter
@@ -178,6 +179,40 @@ public abstract class Query extends OperationWithAttributes {
                           IsolationLevel.fromBytes(attr);
   }
 
+  /**
+   * Set the value indicating whether loading CFs on demand should be allowed (cluster
+   * default is false). On-demand CF loading doesn't load column families until necessary,
e.g.
+   * if you filter on one column, the other column family data will be loaded only for the
rows
+   * that are included in result, not all rows like in normal case.
+   * With column-specific filters, like SingleColumnValueFilter w/filterIfMissing == true,
+   * this can deliver huge perf gains when there's a cf with lots of data; however, it can
+   * also lead to some inconsistent results, as follows:
+   * - if someone does a concurrent update to both column families in question you may get
a row
+   *   that never existed, e.g. for { rowKey = 5, { cat_videos =&gt; 1 }, { video =&gt;
"my cat" } }
+   *   someone puts rowKey 5 with { cat_videos =&gt; 0 }, { video =&gt; "my dog"
}, concurrent scan
+   *   filtering on "cat_videos == 1" can get { rowKey = 5, { cat_videos =&gt; 1 },
+   *   { video =&gt; "my dog" } }.
+   * - if there's a concurrent split and you have more than 2 column families, some rows
may be
+   *   missing some column families.
+   */
+  public Query setLoadColumnFamiliesOnDemand(boolean value) {
+    this.loadColumnFamiliesOnDemand = value;
+    return this;
+  }
+
+  /**
+   * Get the raw loadColumnFamiliesOnDemand setting; if it's not set, can be null.
+   */
+  public Boolean getLoadColumnFamiliesOnDemandValue() {
+    return this.loadColumnFamiliesOnDemand;
+  }
+
+  /**
+   * Get the logical value indicating whether on-demand CF loading should be allowed.
+   */
+  public boolean doLoadColumnFamiliesOnDemand() {
+    return (this.loadColumnFamiliesOnDemand != null) && this.loadColumnFamiliesOnDemand;
+  }
 
   /**
    * Get versions of columns only within the specified timestamp range,

http://git-wip-us.apache.org/repos/asf/hbase/blob/509c1b63/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
index 4ebab76..c71c03a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
@@ -146,7 +146,6 @@ public class Scan extends Query {
   private TimeRange tr = new TimeRange();
   private Map<byte [], NavigableSet<byte []>> familyMap =
     new TreeMap<byte [], NavigableSet<byte []>>(Bytes.BYTES_COMPARATOR);
-  private Boolean loadColumnFamiliesOnDemand = null;
 
   /**
    * Set it true for small scan to get better performance
@@ -265,6 +264,7 @@ public class Scan extends Query {
     this.getScan = true;
     this.consistency = get.getConsistency();
     this.setIsolationLevel(get.getIsolationLevel());
+    this.loadColumnFamiliesOnDemand = get.getLoadColumnFamiliesOnDemandValue();
     for (Map.Entry<String, byte[]> attr : get.getAttributesMap().entrySet()) {
       setAttribute(attr.getKey(), attr.getValue());
     }
@@ -725,40 +725,8 @@ public class Scan extends Query {
     return allowPartialResults;
   }
 
-  /**
-   * Set the value indicating whether loading CFs on demand should be allowed (cluster
-   * default is false). On-demand CF loading doesn't load column families until necessary,
e.g.
-   * if you filter on one column, the other column family data will be loaded only for the
rows
-   * that are included in result, not all rows like in normal case.
-   * With column-specific filters, like SingleColumnValueFilter w/filterIfMissing == true,
-   * this can deliver huge perf gains when there's a cf with lots of data; however, it can
-   * also lead to some inconsistent results, as follows:
-   * - if someone does a concurrent update to both column families in question you may get
a row
-   *   that never existed, e.g. for { rowKey = 5, { cat_videos =&gt; 1 }, { video =&gt;
"my cat" } }
-   *   someone puts rowKey 5 with { cat_videos =&gt; 0 }, { video =&gt; "my dog"
}, concurrent scan
-   *   filtering on "cat_videos == 1" can get { rowKey = 5, { cat_videos =&gt; 1 },
-   *   { video =&gt; "my dog" } }.
-   * - if there's a concurrent split and you have more than 2 column families, some rows
may be
-   *   missing some column families.
-   */
   public Scan setLoadColumnFamiliesOnDemand(boolean value) {
-    this.loadColumnFamiliesOnDemand = value;
-    return this;
-  }
-
-  /**
-   * Get the raw loadColumnFamiliesOnDemand setting; if it's not set, can be null.
-   */
-  public Boolean getLoadColumnFamiliesOnDemandValue() {
-    return this.loadColumnFamiliesOnDemand;
-  }
-
-  /**
-   * Get the logical value indicating whether on-demand CF loading should be allowed.
-   */
-  public boolean doLoadColumnFamiliesOnDemand() {
-    return (this.loadColumnFamiliesOnDemand != null)
-      && this.loadColumnFamiliesOnDemand.booleanValue();
+    return (Scan) super.setLoadColumnFamiliesOnDemand(value);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/509c1b63/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
index 9318a4c..edd395a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
@@ -509,6 +509,9 @@ public final class ProtobufUtil {
     if (proto.hasConsistency()) {
       get.setConsistency(toConsistency(proto.getConsistency()));
     }
+    if (proto.hasLoadColumnFamiliesOnDemand()) {
+      get.setLoadColumnFamiliesOnDemand(proto.getLoadColumnFamiliesOnDemand());
+    }
     return get;
   }
 
@@ -875,7 +878,7 @@ public final class ProtobufUtil {
     }
     Boolean loadColumnFamiliesOnDemand = scan.getLoadColumnFamiliesOnDemandValue();
     if (loadColumnFamiliesOnDemand != null) {
-      scanBuilder.setLoadColumnFamiliesOnDemand(loadColumnFamiliesOnDemand.booleanValue());
+      scanBuilder.setLoadColumnFamiliesOnDemand(loadColumnFamiliesOnDemand);
     }
     scanBuilder.setMaxVersions(scan.getMaxVersions());
     for (Entry<byte[], TimeRange> cftr : scan.getColumnFamilyTimeRange().entrySet())
{
@@ -1102,6 +1105,10 @@ public final class ProtobufUtil {
     if (get.getConsistency() != null && get.getConsistency() != Consistency.STRONG)
{
       builder.setConsistency(toConsistency(get.getConsistency()));
     }
+    Boolean loadColumnFamiliesOnDemand = get.getLoadColumnFamiliesOnDemandValue();
+    if (loadColumnFamiliesOnDemand != null) {
+      builder.setLoadColumnFamiliesOnDemand(loadColumnFamiliesOnDemand);
+    }
 
     return builder.build();
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/509c1b63/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java
index d843723..c5b3a6b 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java
@@ -19,6 +19,8 @@
 
 package org.apache.hadoop.hbase.client;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.IOException;
@@ -26,6 +28,7 @@ import java.util.Arrays;
 import java.util.Set;
 
 import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.apache.hadoop.hbase.filter.FilterList;
 import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.protobuf.generated.ClientProtos;
 import org.apache.hadoop.hbase.security.visibility.Authorizations;
@@ -56,6 +59,35 @@ public class TestScan {
   }
 
   @Test
+  public void testGetToScan() throws IOException {
+    Get get = new Get(Bytes.toBytes(1));
+    get.setCacheBlocks(true).setConsistency(Consistency.TIMELINE).setFilter(new FilterList())
+        .setId("get").setIsolationLevel(IsolationLevel.READ_COMMITTED)
+        .setLoadColumnFamiliesOnDemand(false).setMaxResultsPerColumnFamily(1000)
+        .setMaxVersions(9999).setRowOffsetPerColumnFamily(5).setTimeRange(0, 13)
+        .setAttribute("att_v0", Bytes.toBytes("att_v0"))
+        .setColumnFamilyTimeRange(Bytes.toBytes("cf"), 0, 123);
+    Scan scan = new Scan(get);
+    assertEquals(get.getCacheBlocks(), scan.getCacheBlocks());
+    assertEquals(get.getConsistency(), scan.getConsistency());
+    assertEquals(get.getFilter(), scan.getFilter());
+    assertEquals(get.getId(), scan.getId());
+    assertEquals(get.getIsolationLevel(), scan.getIsolationLevel());
+    assertEquals(get.getLoadColumnFamiliesOnDemandValue(),
+      scan.getLoadColumnFamiliesOnDemandValue());
+    assertEquals(get.getMaxResultsPerColumnFamily(), scan.getMaxResultsPerColumnFamily());
+    assertEquals(get.getMaxVersions(), scan.getMaxVersions());
+    assertEquals(get.getRowOffsetPerColumnFamily(), scan.getRowOffsetPerColumnFamily());
+    assertEquals(get.getTimeRange().getMin(), scan.getTimeRange().getMin());
+    assertEquals(get.getTimeRange().getMax(), scan.getTimeRange().getMax());
+    assertTrue(Bytes.equals(get.getAttribute("att_v0"), scan.getAttribute("att_v0")));
+    assertEquals(get.getColumnFamilyTimeRange().get(Bytes.toBytes("cf")).getMin(),
+      scan.getColumnFamilyTimeRange().get(Bytes.toBytes("cf")).getMin());
+    assertEquals(get.getColumnFamilyTimeRange().get(Bytes.toBytes("cf")).getMax(),
+      scan.getColumnFamilyTimeRange().get(Bytes.toBytes("cf")).getMax());
+  }
+
+  @Test
   public void testScanAttributes() {
     Scan scan = new Scan();
     Assert.assertTrue(scan.getAttributesMap().isEmpty());

http://git-wip-us.apache.org/repos/asf/hbase/blob/509c1b63/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/ClientProtos.java
----------------------------------------------------------------------
diff --git a/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/ClientProtos.java
b/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/ClientProtos.java
index 3f7ba80..92957af 100644
--- a/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/ClientProtos.java
+++ b/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/ClientProtos.java
@@ -1980,6 +1980,24 @@ public final class ClientProtos {
      */
     org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ColumnFamilyTimeRangeOrBuilder
getCfTimeRangeOrBuilder(
         int index);
+
+    // optional bool load_column_families_on_demand = 14;
+    /**
+     * <code>optional bool load_column_families_on_demand = 14;</code>
+     *
+     * <pre>
+     * DO NOT add defaults to load_column_families_on_demand.
+     * </pre>
+     */
+    boolean hasLoadColumnFamiliesOnDemand();
+    /**
+     * <code>optional bool load_column_families_on_demand = 14;</code>
+     *
+     * <pre>
+     * DO NOT add defaults to load_column_families_on_demand.
+     * </pre>
+     */
+    boolean getLoadColumnFamiliesOnDemand();
   }
   /**
    * Protobuf type {@code Get}
@@ -2136,6 +2154,11 @@ public final class ClientProtos {
               cfTimeRange_.add(input.readMessage(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ColumnFamilyTimeRange.PARSER,
extensionRegistry));
               break;
             }
+            case 112: {
+              bitField0_ |= 0x00000400;
+              loadColumnFamiliesOnDemand_ = input.readBool();
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -2485,6 +2508,30 @@ public final class ClientProtos {
       return cfTimeRange_.get(index);
     }
 
+    // optional bool load_column_families_on_demand = 14;
+    public static final int LOAD_COLUMN_FAMILIES_ON_DEMAND_FIELD_NUMBER = 14;
+    private boolean loadColumnFamiliesOnDemand_;
+    /**
+     * <code>optional bool load_column_families_on_demand = 14;</code>
+     *
+     * <pre>
+     * DO NOT add defaults to load_column_families_on_demand.
+     * </pre>
+     */
+    public boolean hasLoadColumnFamiliesOnDemand() {
+      return ((bitField0_ & 0x00000400) == 0x00000400);
+    }
+    /**
+     * <code>optional bool load_column_families_on_demand = 14;</code>
+     *
+     * <pre>
+     * DO NOT add defaults to load_column_families_on_demand.
+     * </pre>
+     */
+    public boolean getLoadColumnFamiliesOnDemand() {
+      return loadColumnFamiliesOnDemand_;
+    }
+
     private void initFields() {
       row_ = com.google.protobuf.ByteString.EMPTY;
       column_ = java.util.Collections.emptyList();
@@ -2499,6 +2546,7 @@ public final class ClientProtos {
       closestRowBefore_ = false;
       consistency_ = org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Consistency.STRONG;
       cfTimeRange_ = java.util.Collections.emptyList();
+      loadColumnFamiliesOnDemand_ = false;
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
@@ -2579,6 +2627,9 @@ public final class ClientProtos {
       for (int i = 0; i < cfTimeRange_.size(); i++) {
         output.writeMessage(13, cfTimeRange_.get(i));
       }
+      if (((bitField0_ & 0x00000400) == 0x00000400)) {
+        output.writeBool(14, loadColumnFamiliesOnDemand_);
+      }
       getUnknownFields().writeTo(output);
     }
 
@@ -2640,6 +2691,10 @@ public final class ClientProtos {
         size += com.google.protobuf.CodedOutputStream
           .computeMessageSize(13, cfTimeRange_.get(i));
       }
+      if (((bitField0_ & 0x00000400) == 0x00000400)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBoolSize(14, loadColumnFamiliesOnDemand_);
+      }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
       return size;
@@ -2719,6 +2774,11 @@ public final class ClientProtos {
       }
       result = result && getCfTimeRangeList()
           .equals(other.getCfTimeRangeList());
+      result = result && (hasLoadColumnFamiliesOnDemand() == other.hasLoadColumnFamiliesOnDemand());
+      if (hasLoadColumnFamiliesOnDemand()) {
+        result = result && (getLoadColumnFamiliesOnDemand()
+            == other.getLoadColumnFamiliesOnDemand());
+      }
       result = result &&
           getUnknownFields().equals(other.getUnknownFields());
       return result;
@@ -2784,6 +2844,10 @@ public final class ClientProtos {
         hash = (37 * hash) + CF_TIME_RANGE_FIELD_NUMBER;
         hash = (53 * hash) + getCfTimeRangeList().hashCode();
       }
+      if (hasLoadColumnFamiliesOnDemand()) {
+        hash = (37 * hash) + LOAD_COLUMN_FAMILIES_ON_DEMAND_FIELD_NUMBER;
+        hash = (53 * hash) + hashBoolean(getLoadColumnFamiliesOnDemand());
+      }
       hash = (29 * hash) + getUnknownFields().hashCode();
       memoizedHashCode = hash;
       return hash;
@@ -2952,6 +3016,8 @@ public final class ClientProtos {
         } else {
           cfTimeRangeBuilder_.clear();
         }
+        loadColumnFamiliesOnDemand_ = false;
+        bitField0_ = (bitField0_ & ~0x00002000);
         return this;
       }
 
@@ -3055,6 +3121,10 @@ public final class ClientProtos {
         } else {
           result.cfTimeRange_ = cfTimeRangeBuilder_.build();
         }
+        if (((from_bitField0_ & 0x00002000) == 0x00002000)) {
+          to_bitField0_ |= 0x00000400;
+        }
+        result.loadColumnFamiliesOnDemand_ = loadColumnFamiliesOnDemand_;
         result.bitField0_ = to_bitField0_;
         onBuilt();
         return result;
@@ -3179,6 +3249,9 @@ public final class ClientProtos {
             }
           }
         }
+        if (other.hasLoadColumnFamiliesOnDemand()) {
+          setLoadColumnFamiliesOnDemand(other.getLoadColumnFamiliesOnDemand());
+        }
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
@@ -4498,6 +4571,55 @@ public final class ClientProtos {
         return cfTimeRangeBuilder_;
       }
 
+      // optional bool load_column_families_on_demand = 14;
+      private boolean loadColumnFamiliesOnDemand_ ;
+      /**
+       * <code>optional bool load_column_families_on_demand = 14;</code>
+       *
+       * <pre>
+       * DO NOT add defaults to load_column_families_on_demand.
+       * </pre>
+       */
+      public boolean hasLoadColumnFamiliesOnDemand() {
+        return ((bitField0_ & 0x00002000) == 0x00002000);
+      }
+      /**
+       * <code>optional bool load_column_families_on_demand = 14;</code>
+       *
+       * <pre>
+       * DO NOT add defaults to load_column_families_on_demand.
+       * </pre>
+       */
+      public boolean getLoadColumnFamiliesOnDemand() {
+        return loadColumnFamiliesOnDemand_;
+      }
+      /**
+       * <code>optional bool load_column_families_on_demand = 14;</code>
+       *
+       * <pre>
+       * DO NOT add defaults to load_column_families_on_demand.
+       * </pre>
+       */
+      public Builder setLoadColumnFamiliesOnDemand(boolean value) {
+        bitField0_ |= 0x00002000;
+        loadColumnFamiliesOnDemand_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional bool load_column_families_on_demand = 14;</code>
+       *
+       * <pre>
+       * DO NOT add defaults to load_column_families_on_demand.
+       * </pre>
+       */
+      public Builder clearLoadColumnFamiliesOnDemand() {
+        bitField0_ = (bitField0_ & ~0x00002000);
+        loadColumnFamiliesOnDemand_ = false;
+        onChanged();
+        return this;
+      }
+
       // @@protoc_insertion_point(builder_scope:Get)
     }
 
@@ -34315,7 +34437,7 @@ public final class ClientProtos {
       "ce.proto\"\037\n\016Authorizations\022\r\n\005label\030\001 \003(" +
       "\t\"$\n\016CellVisibility\022\022\n\nexpression\030\001 \002(\t\"" +
       "+\n\006Column\022\016\n\006family\030\001 \002(\014\022\021\n\tqualifier\030\002"
+
-      " \003(\014\"\203\003\n\003Get\022\013\n\003row\030\001 \002(\014\022\027\n\006column\030\002
\003(" +
+      " \003(\014\"\253\003\n\003Get\022\013\n\003row\030\001 \002(\014\022\027\n\006column\030\002
\003(" +
       "\0132\007.Column\022!\n\tattribute\030\003 \003(\0132\016.NameByte" +
       "sPair\022\027\n\006filter\030\004 \001(\0132\007.Filter\022\036\n\ntime_r" +
       "ange\030\005 \001(\0132\n.TimeRange\022\027\n\014max_versions\030\006" +
@@ -34324,12 +34446,13 @@ public final class ClientProtos {
       "\n\016existence_only\030\n \001(\010:\005false\022!\n\022closest" +
       "_row_before\030\013 \001(\010:\005false\022)\n\013consistency\030" +
       "\014 \001(\0162\014.Consistency:\006STRONG\022-\n\rcf_time_r" +
-      "ange\030\r \003(\0132\026.ColumnFamilyTimeRange\"z\n\006Re" +
+      "ange\030\r \003(\0132\026.ColumnFamilyTimeRange\022&\n\036lo" +
+      "ad_column_families_on_demand\030\016 \001(\010\"z\n\006Re" +
       "sult\022\023\n\004cell\030\001 \003(\0132\005.Cell\022\035\n\025associated_" +
       "cell_count\030\002 \001(\005\022\016\n\006exists\030\003 \001(\010\022\024\n\005stal"
+
       "e\030\004 \001(\010:\005false\022\026\n\007partial\030\005 \001(\010:\005false\"A"
+
-      "\n\nGetRequest\022 \n\006region\030\001 \002(\0132\020.RegionSpe" +
-      "cifier\022\021\n\003get\030\002 \002(\0132\004.Get\"&\n\013GetResponse",
+      "\n\nGetRequest\022 \n\006region\030\001 \002(\0132\020.RegionSpe",
+      "cifier\022\021\n\003get\030\002 \002(\0132\004.Get\"&\n\013GetResponse" +
       "\022\027\n\006result\030\001 \001(\0132\007.Result\"\200\001\n\tCondition\022" +
       "\013\n\003row\030\001 \002(\014\022\016\n\006family\030\002 \002(\014\022\021\n\tqualifie"
+
       "r\030\003 \002(\014\022\"\n\014compare_type\030\004 \002(\0162\014.CompareT" +
@@ -34338,8 +34461,8 @@ public final class ClientProtos {
       "pe\030\002 \001(\0162\033.MutationProto.MutationType\0220\n" +
       "\014column_value\030\003 \003(\0132\032.MutationProto.Colu" +
       "mnValue\022\021\n\ttimestamp\030\004 \001(\004\022!\n\tattribute\030" +
-      "\005 \003(\0132\016.NameBytesPair\022:\n\ndurability\030\006 \001(" +
-      "\0162\031.MutationProto.Durability:\013USE_DEFAUL",
+      "\005 \003(\0132\016.NameBytesPair\022:\n\ndurability\030\006 \001(",
+      "\0162\031.MutationProto.Durability:\013USE_DEFAUL" +
       "T\022\036\n\ntime_range\030\007 \001(\0132\n.TimeRange\022\035\n\025ass" +
       "ociated_cell_count\030\010 \001(\005\022\r\n\005nonce\030\t \001(\004\032" +
       "\347\001\n\013ColumnValue\022\016\n\006family\030\001 \002(\014\022B\n\017quali" +
@@ -34348,8 +34471,8 @@ public final class ClientProtos {
       "\n\tqualifier\030\001 \001(\014\022\r\n\005value\030\002 \001(\014\022\021\n\ttime"
+
       "stamp\030\003 \001(\004\022.\n\013delete_type\030\004 \001(\0162\031.Mutat" +
       "ionProto.DeleteType\022\014\n\004tags\030\005 \001(\014\"W\n\nDur" +
-      "ability\022\017\n\013USE_DEFAULT\020\000\022\014\n\010SKIP_WAL\020\001\022\r" +
-      "\n\tASYNC_WAL\020\002\022\014\n\010SYNC_WAL\020\003\022\r\n\tFSYNC_WAL",
+      "ability\022\017\n\013USE_DEFAULT\020\000\022\014\n\010SKIP_WAL\020\001\022\r",
+      "\n\tASYNC_WAL\020\002\022\014\n\010SYNC_WAL\020\003\022\r\n\tFSYNC_WAL" +
       "\020\004\">\n\014MutationType\022\n\n\006APPEND\020\000\022\r\n\tINCREM" +
       "ENT\020\001\022\007\n\003PUT\020\002\022\n\n\006DELETE\020\003\"p\n\nDeleteType" +
       "\022\026\n\022DELETE_ONE_VERSION\020\000\022\034\n\030DELETE_MULTI" +
@@ -34358,8 +34481,8 @@ public final class ClientProtos {
       "\n\006region\030\001 \002(\0132\020.RegionSpecifier\022 \n\010muta" +
       "tion\030\002 \002(\0132\016.MutationProto\022\035\n\tcondition\030" +
       "\003 \001(\0132\n.Condition\022\023\n\013nonce_group\030\004 \001(\004\"<" +
-      "\n\016MutateResponse\022\027\n\006result\030\001 \001(\0132\007.Resul" +
-      "t\022\021\n\tprocessed\030\002 \001(\010\"\207\004\n\004Scan\022\027\n\006column\030",
+      "\n\016MutateResponse\022\027\n\006result\030\001 \001(\0132\007.Resul",
+      "t\022\021\n\tprocessed\030\002 \001(\010\"\207\004\n\004Scan\022\027\n\006column\030"
+
       "\001 \003(\0132\007.Column\022!\n\tattribute\030\002 \003(\0132\016.Name" +
       "BytesPair\022\021\n\tstart_row\030\003 \001(\014\022\020\n\010stop_row" +
       "\030\004 \001(\014\022\027\n\006filter\030\005 \001(\0132\007.Filter\022\036\n\ntime_"
+
@@ -34368,8 +34491,8 @@ public final class ClientProtos {
       "batch_size\030\t \001(\r\022\027\n\017max_result_size\030\n \001(" +
       "\004\022\023\n\013store_limit\030\013 \001(\r\022\024\n\014store_offset\030\014" +
       " \001(\r\022&\n\036load_column_families_on_demand\030\r" +
-      " \001(\010\022\r\n\005small\030\016 \001(\010\022\027\n\010reversed\030\017 \001(\010:\005f"
+
-      "alse\022)\n\013consistency\030\020 \001(\0162\014.Consistency:",
+      " \001(\010\022\r\n\005small\030\016 \001(\010\022\027\n\010reversed\030\017 \001(\010:\005f",
+      "alse\022)\n\013consistency\030\020 \001(\0162\014.Consistency:" +
       "\006STRONG\022\017\n\007caching\030\021 \001(\r\022\035\n\025allow_partia" +
       "l_results\030\022 \001(\010\022-\n\rcf_time_range\030\023 \003(\0132\026" +
       ".ColumnFamilyTimeRange\"\224\002\n\013ScanRequest\022 " +
@@ -34378,8 +34501,8 @@ public final class ClientProtos {
       "ber_of_rows\030\004 \001(\r\022\025\n\rclose_scanner\030\005 \001(\010" +
       "\022\025\n\rnext_call_seq\030\006 \001(\004\022\037\n\027client_handle" +
       "s_partials\030\007 \001(\010\022!\n\031client_handles_heart" +
-      "beats\030\010 \001(\010\022\032\n\022track_scan_metrics\030\t \001(\010\022" +
-      "\024\n\005renew\030\n \001(\010:\005false\"\210\002\n\014ScanResponse\022\030",
+      "beats\030\010 \001(\010\022\032\n\022track_scan_metrics\030\t \001(\010\022",
+      "\024\n\005renew\030\n \001(\010:\005false\"\210\002\n\014ScanResponse\022\030" +
       "\n\020cells_per_result\030\001 \003(\r\022\022\n\nscanner_id\030\002" +
       " \001(\004\022\024\n\014more_results\030\003 \001(\010\022\013\n\003ttl\030\004 \001(\r\022"
+
       "\030\n\007results\030\005 \003(\0132\007.Result\022\r\n\005stale\030\006 \001(\010"
+
@@ -34388,8 +34511,8 @@ public final class ClientProtos {
       "essage\030\t \001(\010\022\"\n\014scan_metrics\030\n \001(\0132\014.Sca" +
       "nMetrics\"\263\001\n\024BulkLoadHFileRequest\022 \n\006reg" +
       "ion\030\001 \002(\0132\020.RegionSpecifier\0225\n\013family_pa" +
-      "th\030\002 \003(\0132 .BulkLoadHFileRequest.FamilyPa" +
-      "th\022\026\n\016assign_seq_num\030\003 \001(\010\032*\n\nFamilyPath",
+      "th\030\002 \003(\0132 .BulkLoadHFileRequest.FamilyPa",
+      "th\022\026\n\016assign_seq_num\030\003 \001(\010\032*\n\nFamilyPath" +
       "\022\016\n\006family\030\001 \002(\014\022\014\n\004path\030\002 \002(\t\"\'\n\025BulkLo"
+
       "adHFileResponse\022\016\n\006loaded\030\001 \002(\010\"a\n\026Copro" +
       "cessorServiceCall\022\013\n\003row\030\001 \002(\014\022\024\n\014servic" +
@@ -34398,8 +34521,8 @@ public final class ClientProtos {
       "\n\005value\030\001 \001(\0132\016.NameBytesPair\"d\n\031Coproce" +
       "ssorServiceRequest\022 \n\006region\030\001 \002(\0132\020.Reg" +
       "ionSpecifier\022%\n\004call\030\002 \002(\0132\027.Coprocessor" +
-      "ServiceCall\"]\n\032CoprocessorServiceRespons" +
-      "e\022 \n\006region\030\001 \002(\0132\020.RegionSpecifier\022\035\n\005v",
+      "ServiceCall\"]\n\032CoprocessorServiceRespons",
+      "e\022 \n\006region\030\001 \002(\0132\020.RegionSpecifier\022\035\n\005v" +
       "alue\030\002 \002(\0132\016.NameBytesPair\"{\n\006Action\022\r\n\005" +
       "index\030\001 \001(\r\022 \n\010mutation\030\002 \001(\0132\016.Mutation" +
       "Proto\022\021\n\003get\030\003 \001(\0132\004.Get\022-\n\014service_call" +
@@ -34408,8 +34531,8 @@ public final class ClientProtos {
       "r\022\016\n\006atomic\030\002 \001(\010\022\027\n\006action\030\003 \003(\0132\007.Acti"
+
       "on\"c\n\017RegionLoadStats\022\027\n\014memstoreLoad\030\001 " +
       "\001(\005:\0010\022\030\n\rheapOccupancy\030\002 \001(\005:\0010\022\035\n\022comp"
+
-      "actionPressure\030\003 \001(\005:\0010\"\266\001\n\021ResultOrExce" +
-      "ption\022\r\n\005index\030\001 \001(\r\022\027\n\006result\030\002 \001(\0132\007.R",
+      "actionPressure\030\003 \001(\005:\0010\"\266\001\n\021ResultOrExce",
+      "ption\022\r\n\005index\030\001 \001(\r\022\027\n\006result\030\002 \001(\0132\007.R"
+
       "esult\022!\n\texception\030\003 \001(\0132\016.NameBytesPair" +
       "\0221\n\016service_result\030\004 \001(\0132\031.CoprocessorSe" +
       "rviceResult\022#\n\tloadStats\030\005 \001(\0132\020.RegionL" +
@@ -34418,8 +34541,8 @@ public final class ClientProtos {
       "\texception\030\002 \001(\0132\016.NameBytesPair\"f\n\014Mult" +
       "iRequest\022#\n\014regionAction\030\001 \003(\0132\r.RegionA" +
       "ction\022\022\n\nnonceGroup\030\002 \001(\004\022\035\n\tcondition\030\003" +
-      " \001(\0132\n.Condition\"S\n\rMultiResponse\022/\n\022reg" +
-      "ionActionResult\030\001 \003(\0132\023.RegionActionResu",
+      " \001(\0132\n.Condition\"S\n\rMultiResponse\022/\n\022reg",
+      "ionActionResult\030\001 \003(\0132\023.RegionActionResu" +
       "lt\022\021\n\tprocessed\030\002 \001(\010*\'\n\013Consistency\022\n\n\006" +
       "STRONG\020\000\022\014\n\010TIMELINE\020\0012\205\003\n\rClientService" +
       "\022 \n\003Get\022\013.GetRequest\032\014.GetResponse\022)\n\006Mu" +
@@ -34428,8 +34551,8 @@ public final class ClientProtos {
       "lkLoadHFile\022\025.BulkLoadHFileRequest\032\026.Bul" +
       "kLoadHFileResponse\022F\n\013ExecService\022\032.Copr" +
       "ocessorServiceRequest\032\033.CoprocessorServi" +
-      "ceResponse\022R\n\027ExecRegionServerService\022\032." +
-      "CoprocessorServiceRequest\032\033.CoprocessorS",
+      "ceResponse\022R\n\027ExecRegionServerService\022\032.",
+      "CoprocessorServiceRequest\032\033.CoprocessorS" +
       "erviceResponse\022&\n\005Multi\022\r.MultiRequest\032\016" +
       ".MultiResponseBB\n*org.apache.hadoop.hbas" +
       "e.protobuf.generatedB\014ClientProtosH\001\210\001\001\240" +
@@ -34463,7 +34586,7 @@ public final class ClientProtos {
           internal_static_Get_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_Get_descriptor,
-              new java.lang.String[] { "Row", "Column", "Attribute", "Filter", "TimeRange",
"MaxVersions", "CacheBlocks", "StoreLimit", "StoreOffset", "ExistenceOnly", "ClosestRowBefore",
"Consistency", "CfTimeRange", });
+              new java.lang.String[] { "Row", "Column", "Attribute", "Filter", "TimeRange",
"MaxVersions", "CacheBlocks", "StoreLimit", "StoreOffset", "ExistenceOnly", "ClosestRowBefore",
"Consistency", "CfTimeRange", "LoadColumnFamiliesOnDemand", });
           internal_static_Result_descriptor =
             getDescriptor().getMessageTypes().get(4);
           internal_static_Result_fieldAccessorTable = new

http://git-wip-us.apache.org/repos/asf/hbase/blob/509c1b63/hbase-protocol/src/main/protobuf/Client.proto
----------------------------------------------------------------------
diff --git a/hbase-protocol/src/main/protobuf/Client.proto b/hbase-protocol/src/main/protobuf/Client.proto
index fcd93fd..3bb7608 100644
--- a/hbase-protocol/src/main/protobuf/Client.proto
+++ b/hbase-protocol/src/main/protobuf/Client.proto
@@ -87,6 +87,7 @@ message Get {
 
   optional Consistency consistency = 12 [default = STRONG];
   repeated ColumnFamilyTimeRange cf_time_range = 13;
+  optional bool load_column_families_on_demand = 14; /* DO NOT add defaults to load_column_families_on_demand.
*/
 }
 
 message Result {

http://git-wip-us.apache.org/repos/asf/hbase/blob/509c1b63/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index ef9a81a..d2785bf 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -6881,6 +6881,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
       scan = new Scan(get);
     }
 
+    if (scan.getLoadColumnFamiliesOnDemandValue() == null) {
+      scan.setLoadColumnFamiliesOnDemand(isLoadingCfsOnDemandDefault());
+    }
     RegionScanner scanner = null;
     try {
       scanner = getScanner(scan);

http://git-wip-us.apache.org/repos/asf/hbase/blob/509c1b63/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
index e8c6776..67f6287 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
@@ -33,6 +33,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.NavigableMap;
@@ -5614,6 +5615,50 @@ public class TestFromClientSide {
   }
 
   @Test
+  public void testEmptyFilterList() throws Exception {
+    // Test Initialization.
+    TableName TABLE = TableName.valueOf("testEmptyFilterList");
+    Table table = TEST_UTIL.createTable(TABLE, FAMILY);
+
+    // Insert one row each region
+    Put put = new Put(Bytes.toBytes("row"));
+    put.addColumn(FAMILY, QUALIFIER, VALUE);
+    table.put(put);
+
+    List<Result> scanResults = new LinkedList<>();
+    Scan scan = new Scan();
+    scan.setFilter(new FilterList());
+    try (ResultScanner scanner = table.getScanner(scan)) {
+      for (Result r : scanner) {
+        scanResults.add(r);
+      }
+    }
+
+    Get g = new Get(Bytes.toBytes("row"));
+    g.setFilter(new FilterList());
+    Result getResult = table.get(g);
+    if (scanResults.isEmpty()) {
+      assertTrue(getResult.isEmpty());
+    } else if (scanResults.size() == 1) {
+      Result scanResult = scanResults.get(0);
+      assertEquals(scanResult.rawCells().length, getResult.rawCells().length);
+      for (int i = 0; i != scanResult.rawCells().length; ++i) {
+        Cell scanCell = scanResult.rawCells()[i];
+        Cell getCell = getResult.rawCells()[i];
+        assertEquals(0, Bytes.compareTo(CellUtil.cloneRow(scanCell), CellUtil.cloneRow(getCell)));
+        assertEquals(0,
+          Bytes.compareTo(CellUtil.cloneFamily(scanCell), CellUtil.cloneFamily(getCell)));
+        assertEquals(0,
+          Bytes.compareTo(CellUtil.cloneQualifier(scanCell), CellUtil.cloneQualifier(getCell)));
+        assertEquals(0,
+          Bytes.compareTo(CellUtil.cloneValue(scanCell), CellUtil.cloneValue(getCell)));
+      }
+    } else {
+      fail("The result retrieved from SCAN and Get should be same");
+    }
+  }
+
+  @Test
   public void testSmallScan() throws Exception {
     // Test Initialization.
     TableName TABLE = TableName.valueOf("testSmallScan");

http://git-wip-us.apache.org/repos/asf/hbase/blob/509c1b63/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
index ddbbb74..7cff7fd 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
@@ -82,6 +82,7 @@ public class TestProtobufUtil {
     columnBuilder.clear();
     columnBuilder.setFamily(ByteString.copyFromUtf8("f2"));
     getBuilder.addColumn(columnBuilder.build());
+    getBuilder.setLoadColumnFamiliesOnDemand(true);
 
     ClientProtos.Get proto = getBuilder.build();
     // default fields


Mime
View raw message