Review Board 1.7.22


HBASE-2233 Support both Hadoop 0.20, 0.21, and 0.22

Review Request #858 - Created June 6, 2011 and updated

Michael Stack
HBASE-2233
Reviewers
hbase
hbase-git
Patch for HBASE TRUNK that makes it so we run on hadoop 0.20.x or hadoop 0.22 branch (as it is now).

Needed hdfs-1948 and hadoop-7531 applied to hadoop 0.22 branch.  Because these issues are NOT in hadoop 0.21, hbase will not work against 0.21 hadoop, not w/o these patches and a rebuild.

Ran this patch with hadoop 0.20 and hadoop 0.22 underneath hbase (I used the patch for the pom that is attached to the issue to switch to hadoop 0.22).  All unit tests seem to pass except TestHFileOutputFormat when up on hadoop 0.22; hadoop 0.22 uses avro 1.3.2 whereas hbase is up on avro 1.4.1.  The test fails with a method not found exception.  You need to enable mapreduce logging to see the exception.
src/main/java/org/apache/hadoop/hbase/ipc/ConnectionHeader.java
Revision c2a7649 New Change
[20] 30 lines
[+20]
31
 * The IPC connection header sent by the client to the server
31
 * The IPC connection header sent by the client to the server
32
 * on connection establishment.
32
 * on connection establishment.
33
 */
33
 */
34
class ConnectionHeader implements Writable {
34
class ConnectionHeader implements Writable {
35
  private String protocol;
35
  private String protocol;
36
  private UserGroupInformation ugi = null;

   
37

    
   
36

   
38
  public ConnectionHeader() {}
37
  public ConnectionHeader() {}
39

    
   
38

   
40
  /**
39
  /**
41
   * Create a new {@link ConnectionHeader} with the given <code>protocol</code>
40
   * Create a new {@link ConnectionHeader} with the given <code>protocol</code>
42
   * and {@link UserGroupInformation}.
41
   * and {@link UserGroupInformation}.
43
   * @param protocol protocol used for communication between the IPC client
42
   * @param protocol protocol used for communication between the IPC client
44
   *                 and the server
43
   *                 and the server
45
   * @param ugi {@link UserGroupInformation} of the client communicating with
44
   * @param ugi {@link UserGroupInformation} of the client communicating with
46
   *            the server
45
   *            the server
47
   */
46
   */
48
  public ConnectionHeader(String protocol, UserGroupInformation ugi) {
47
  public ConnectionHeader(String protocol, UserGroupInformation ugi) {
49
    this.protocol = protocol;
48
    this.protocol = protocol;
50
    this.ugi = ugi;

   
51
  }
49
  }
52

    
   
50

   
53
  @Override
51
  @Override
54
  public void readFields(DataInput in) throws IOException {
52
  public void readFields(DataInput in) throws IOException {
55
    protocol = Text.readString(in);
53
    protocol = Text.readString(in);
56
    if (protocol.isEmpty()) {
54
    if (protocol.isEmpty()) {
57
      protocol = null;
55
      protocol = null;
58
    }
56
    }
59

    
   

   
60
    boolean ugiUsernamePresent = in.readBoolean();

   
61
    if (ugiUsernamePresent) {

   
62
      String username = in.readUTF();

   
63
      ugi.readFields(in);

   
64
    } else {

   
65
      ugi = null;

   
66
    }

   
67
  }
57
  }
68

    
   
58

   
69
  @Override
59
  @Override
70
  public void write(DataOutput out) throws IOException {
60
  public void write(DataOutput out) throws IOException {
71
    Text.writeString(out, (protocol == null) ? "" : protocol);
61
    Text.writeString(out, (protocol == null) ? "" : protocol);
72
    if (ugi != null) {

   
73
      //Send both effective user and real user for simple auth

   
74
      out.writeBoolean(true);

   
75
      out.writeUTF(ugi.getUserName());

   
76
    } else {

   
77
      out.writeBoolean(false);

   
78
    }

   
79
  }
62
  }
80

    
   
63

   
81
  public String getProtocol() {
64
  public String getProtocol() {
82
    return protocol;
65
    return protocol;
83
  }
66
  }
84

    
   
67

   
85
  public UserGroupInformation getUgi() {
68
  public UserGroupInformation getUgi() {
86
    return ugi;
69
    return null;
87
  }
70
  }
88

    
   
71

   
89
  public String toString() {
72
  public String toString() {
90
    return protocol + "-" + ugi;
73
    return protocol;
91
  }
74
  }
92
}
75
}
src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat.java
Revision 95407d1 New Change
 
src/main/java/org/apache/hadoop/hbase/mapreduce/hadoopbackport/InputSampler.java
Revision c3e0a68 New Change
 
src/main/java/org/apache/hadoop/hbase/master/HMaster.java
Revision b8489ac New Change
 
src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
Revision f735e41 New Change
 
src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Revision 6404538 New Change
 
src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
Revision 0716788 New Change
 
src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
Revision db29e56 New Change
 
src/main/java/org/apache/hadoop/hbase/regionserver/wal/SequenceFileLogWriter.java
Revision 8dc9a5e New Change
 
src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
Revision 3409108 New Change
 
src/main/java/org/apache/hadoop/hbase/util/InfoServer.java
Revision 6ed9fe6 New Change
 
src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
Revision babd788 New Change
 
src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java
Revision f6a7210 New Change
 
src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLogSplit.java
Revision f1f4c6b New Change
 
src/test/java/org/apache/hadoop/hbase/replication/TestReplication.java
Revision 5b487a9 New Change
 
src/test/java/org/apache/hadoop/hbase/util/TestFSUtils.java
Revision c8fc065 New Change
 
  1. src/main/java/org/apache/hadoop/hbase/ipc/ConnectionHeader.java: Loading...
  2. src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat.java: Loading...
  3. src/main/java/org/apache/hadoop/hbase/mapreduce/hadoopbackport/InputSampler.java: Loading...
  4. src/main/java/org/apache/hadoop/hbase/master/HMaster.java: Loading...
  5. src/main/java/org/apache/hadoop/hbase/master/ServerManager.java: Loading...
  6. src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java: Loading...
  7. src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java: Loading...
  8. src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java: Loading...
  9. src/main/java/org/apache/hadoop/hbase/regionserver/wal/SequenceFileLogWriter.java: Loading...
  10. src/main/java/org/apache/hadoop/hbase/util/FSUtils.java: Loading...
  11. src/main/java/org/apache/hadoop/hbase/util/InfoServer.java: Loading...
  12. src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java: Loading...
  13. src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java: Loading...
  14. src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLogSplit.java: Loading...
  15. src/test/java/org/apache/hadoop/hbase/replication/TestReplication.java: Loading...
  16. src/test/java/org/apache/hadoop/hbase/util/TestFSUtils.java: Loading...