hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chia7...@apache.org
Subject hbase git commit: Revert "HBASE-18267 The result from the postAppend is ignored" It breaks the compatibility This reverts commit 0b31a730065ea4bfb6354646611049dda56350fa.
Date Mon, 21 Aug 2017 19:49:53 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.3 952b39b3a -> 6e5661c1f


Revert "HBASE-18267 The result from the postAppend is ignored"
It breaks the compatibility
This reverts commit 0b31a730065ea4bfb6354646611049dda56350fa.


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

Branch: refs/heads/branch-1.3
Commit: 6e5661c1febf30667467e42a542cddd0161aa305
Parents: 952b39b
Author: Chia-Ping Tsai <chia7712@gmail.com>
Authored: Tue Aug 22 03:47:41 2017 +0800
Committer: Chia-Ping Tsai <chia7712@gmail.com>
Committed: Tue Aug 22 03:47:41 2017 +0800

----------------------------------------------------------------------
 .../hbase/regionserver/RSRpcServices.java       |   2 +-
 .../regionserver/RegionCoprocessorHost.java     |   7 +-
 .../hbase/client/TestResultFromCoprocessor.java | 128 -------------------
 3 files changed, 4 insertions(+), 133 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/6e5661c1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
index 5d6df74..cda48fc 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
@@ -582,7 +582,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
         }
       }
       if (region.getCoprocessorHost() != null) {
-        r = region.getCoprocessorHost().postAppend(append, r);
+        region.getCoprocessorHost().postAppend(append, r);
       }
     }
     if (regionServer.metricsRegionServer != null) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/6e5661c1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
index 0a7eb67..1ed866a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
@@ -1259,13 +1259,12 @@ public class RegionCoprocessorHost
    * @param result the result returned by the append
    * @throws IOException if an error occurred on the coprocessor
    */
-  public Result postAppend(final Append append, final Result result) throws IOException {
-    return execOperationWithResult(result,
-        coprocessors.isEmpty() ? null : new RegionOperationWithResult<Result>() {
+  public void postAppend(final Append append, final Result result) throws IOException {
+    execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
       @Override
       public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment>
ctx)
           throws IOException {
-        setResult(oserver.postAppend(ctx, append, result));
+        oserver.postAppend(ctx, append, result);
       }
     });
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/6e5661c1/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultFromCoprocessor.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultFromCoprocessor.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultFromCoprocessor.java
deleted file mode 100644
index 79cf297..0000000
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultFromCoprocessor.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Copyright The Apache Software Foundation
- *
- * 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.
- */
-package org.apache.hadoop.hbase.client;
-
-import java.io.IOException;
-import java.util.Arrays;
-import static junit.framework.TestCase.assertTrue;
-import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.CellUtil;
-import org.apache.hadoop.hbase.CoprocessorEnvironment;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HColumnDescriptor;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
-import org.apache.hadoop.hbase.coprocessor.ObserverContext;
-import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
-import org.apache.hadoop.hbase.testclassification.ClientTests;
-import org.apache.hadoop.hbase.testclassification.MediumTests;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category({MediumTests.class, ClientTests.class})
-public class TestResultFromCoprocessor {
-  private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
-  private static final byte[] ROW = Bytes.toBytes("normal_row");
-  private static final byte[] FAMILY = Bytes.toBytes("fm");
-  private static final byte[] QUAL = Bytes.toBytes("qual");
-  private static final byte[] VALUE = Bytes.toBytes(100L);
-  private static final byte[] FIXED_VALUE = Bytes.toBytes("fixed_value");
-  private static final Cell FIXED_CELL = CellUtil.createCell(ROW, FAMILY,
-          QUAL, 0, KeyValue.Type.Put.getCode(), FIXED_VALUE);
-  private static final Result FIXED_RESULT = Result.create(Arrays.asList(FIXED_CELL));
-  private static final TableName TABLE_NAME = TableName.valueOf("TestResultFromCoprocessor");
-  @BeforeClass
-  public static void setUpBeforeClass() throws Exception {
-    TEST_UTIL.startMiniCluster(3);
-    HTableDescriptor desc = new HTableDescriptor(TABLE_NAME);
-    desc.addCoprocessor(MyObserver.class.getName())
-        .addFamily(new HColumnDescriptor(FAMILY));
-    TEST_UTIL.getHBaseAdmin().createTable(desc);
-  }
-
-  @AfterClass
-  public static void tearDownAfterClass() throws Exception {
-    TEST_UTIL.shutdownMiniCluster();
-  }
-
-  @Test
-  public void testAppend() throws IOException {
-    try (Table t = TEST_UTIL.getConnection().getTable(TABLE_NAME)) {
-      Put put = new Put(ROW);
-      put.addColumn(FAMILY, QUAL, VALUE);
-      t.put(put);
-      assertRowAndValue(t.get(new Get(ROW)), ROW, VALUE);
-      Append append = new Append(ROW);
-      append.add(FAMILY, QUAL, FIXED_VALUE);
-      assertRowAndValue(t.append(append), ROW, FIXED_VALUE);
-      assertRowAndValue(t.get(new Get(ROW)), ROW, Bytes.add(VALUE, FIXED_VALUE));
-    }
-  }
-
-  @Test
-  public void testIncrement() throws IOException {
-    try (Table t = TEST_UTIL.getConnection().getTable(TABLE_NAME)) {
-      Put put = new Put(ROW);
-      put.addColumn(FAMILY, QUAL, VALUE);
-      t.put(put);
-      assertRowAndValue(t.get(new Get(ROW)), ROW, VALUE);
-      Increment inc = new Increment(ROW);
-      inc.addColumn(FAMILY, QUAL, 99);
-      assertRowAndValue(t.increment(inc), ROW, FIXED_VALUE);
-      assertRowAndValue(t.get(new Get(ROW)), ROW, Bytes.toBytes(199L));
-    }
-  }
-
-  private static void assertRowAndValue(Result r, byte[] row, byte[] value) {
-    for (Cell c : r.rawCells()) {
-      assertTrue(Bytes.equals(CellUtil.cloneRow(c), row));
-      assertTrue(Bytes.equals(CellUtil.cloneValue(c), value));
-    }
-  }
-
-  public static class MyObserver extends BaseRegionObserver {
-
-    @Override
-    public Result postAppend(final ObserverContext<RegionCoprocessorEnvironment> c,
-      final Append append, final Result result) {
-      return FIXED_RESULT;
-    }
-
-    @Override
-    public Result postIncrement(final ObserverContext<RegionCoprocessorEnvironment>
c,
-      final Increment increment, final Result result) {
-      return FIXED_RESULT;
-    }
-
-    @Override
-    public void start(CoprocessorEnvironment env) throws IOException {
-    }
-
-    @Override
-    public void stop(CoprocessorEnvironment env) throws IOException {
-    }
-  }
-
-}


Mime
View raw message