hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Enis Soztutar (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HBASE-11679) Replace "HTable" with "HTableInterface" where backwards-compatible
Date Tue, 09 Sep 2014 02:47:29 GMT

     [ https://issues.apache.org/jira/browse/HBASE-11679?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Enis Soztutar updated HBASE-11679:
----------------------------------
    Attachment: hbase-11679_v6.patch

I've reviewed the v5 patch (560K!), it seems pretty good except for two things. 

Attaching v6 patch, which does not have some accidental reverts in v5 patch (in TableSplit.java,
etc), and also does not have these changes: 

{code}
--- hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java
+++ hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.filter.Filter;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.regionserver.HRegion;
@@ -158,7 +159,7 @@ implements InputFormat<ImmutableBytesWritable, Result> {
   /**
    * Allows subclasses to get the {@link HTable}.
    */
-  protected HTable getHTable() {
+  protected Table getHTable() {
     return this.table;
   }
{code}
and
{code}
--- hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableOutputFormat.java
+++ hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableOutputFormat.java
@@ -33,6 +33,8 @@ import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Durability;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.mapreduce.JobContext;
@@ -99,7 +101,7 @@ public class MultiTableOutputFormat extends OutputFormat<ImmutableBytesWritable,
      * @throws IOException
      *           if there is a problem opening a table
      */
-    HTable getTable(ImmutableBytesWritable tableName) throws IOException {
+    Table getTable(ImmutableBytesWritable tableName) throws IOException {
{code}

I think both of these may not be backwards compatible since they are InterfaceAudience.Public
classes. 

I'll commit v6 if hadoopqa passes. 

> Replace "HTable" with "HTableInterface" where backwards-compatible
> ------------------------------------------------------------------
>
>                 Key: HBASE-11679
>                 URL: https://issues.apache.org/jira/browse/HBASE-11679
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Carter
>            Assignee: Carter
>         Attachments: HBASE_11679.patch, HBASE_11679.patch, HBASE_11679_v3.patch, HBASE_11679_v4.patch,
HBASE_11679_v5.patch, hbase-11679_v6.patch
>
>
> This is a refactor to move more of the code towards using interfaces for proper encapsulation
of logic.
> The amount of code touched is large, but it should be fairly easy to review.  It changes
variable declarations from HTable to HTableInterface where the following holds:
> # The declaration being updated won't break assignment
> # The declaration change does not break the compile (eg trying to access non-interface
methods)
> The two main situations are to change something like this:
> {code}
> HTable h = new HTable(c, tn);
> {code}
> to
> {code}
> HTableInterface h = new HTable(c, tn);
> {code}
> and this:
> {code}
> public void doSomething(HTable h) { ... }
> {code}
> to this:
> {code}
> public void doSomething(HTableInterface h) { ... }
> {code}
> This gets most of the obvious cases out of the way and prepares for more complicated
interface refactors in the future.  In method signatures, I changed parameters, but did _not_
change any public or protected method return values, since that would violate criteria #1
above and break compatibility.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message