You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ji...@apache.org on 2008/06/04 21:24:40 UTC
svn commit: r663350 - in /hadoop/hbase/trunk: CHANGES.txt
src/java/org/apache/hadoop/hbase/HRegionInfo.java
src/java/org/apache/hadoop/hbase/client/UnmodifyableHRegionInfo.java
src/java/org/apache/hadoop/hbase/client/UnmodifyableHTableDescriptor.java
Author: jimk
Date: Wed Jun 4 12:24:40 2008
New Revision: 663350
URL: http://svn.apache.org/viewvc?rev=663350&view=rev
Log:
HBASE-666 UnmodifyableHRegionInfo gives the wrong encoded name
Modified:
hadoop/hbase/trunk/CHANGES.txt
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HRegionInfo.java
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/UnmodifyableHRegionInfo.java
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/UnmodifyableHTableDescriptor.java
Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=663350&r1=663349&r2=663350&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Wed Jun 4 12:24:40 2008
@@ -39,6 +39,7 @@
HBASE-655 Need programmatic way to add column family: need programmatic way
to enable/disable table
HBASE-654 API HTable.getMetadata().addFamily shouldn't be exposed to user
+ HBASE-666 UnmodifyableHRegionInfo gives the wrong encoded name
IMPROVEMENTS
HBASE-559 MR example job to count table rows
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HRegionInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HRegionInfo.java?rev=663350&r1=663349&r2=663350&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HRegionInfo.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HRegionInfo.java Wed Jun 4 12:24:40 2008
@@ -82,7 +82,7 @@
private String regionNameStr = "";
private boolean split = false;
private byte [] startKey = HConstants.EMPTY_BYTE_ARRAY;
- private HTableDescriptor tableDesc = null;
+ protected HTableDescriptor tableDesc = null;
private int hashCode = -1;
public static final int NO_HASH = -1;
private volatile int encodedName = NO_HASH;
@@ -156,6 +156,24 @@
setHashCode();
}
+ /**
+ * Costruct a copy of another HRegionInfo
+ *
+ * @param other
+ */
+ public HRegionInfo(HRegionInfo other) {
+ this.endKey = other.getEndKey();
+ this.offLine = other.isOffline();
+ this.regionId = other.getRegionId();
+ this.regionName = other.getRegionName();
+ this.regionNameStr = Bytes.toString(this.regionName);
+ this.split = other.isSplit();
+ this.startKey = other.getStartKey();
+ this.tableDesc = other.getTableDesc();
+ this.hashCode = other.hashCode();
+ this.encodedName = other.getEncodedName();
+ }
+
private static byte [] createRegionName(final byte [] tableName,
final byte [] startKey, final long regionid) {
return createRegionName(tableName, startKey, Long.toString(regionid));
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/UnmodifyableHRegionInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/UnmodifyableHRegionInfo.java?rev=663350&r1=663349&r2=663350&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/UnmodifyableHRegionInfo.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/UnmodifyableHRegionInfo.java Wed Jun 4 12:24:40 2008
@@ -24,49 +24,14 @@
import org.apache.hadoop.hbase.HTableDescriptor;
class UnmodifyableHRegionInfo extends HRegionInfo {
- /* Default constructor - creates empty object */
- UnmodifyableHRegionInfo() {
- super(new UnmodifyableHTableDescriptor(), null, null);
- }
-
- /*
- * Construct HRegionInfo with explicit parameters
- *
- * @param tableDesc the table descriptor
- * @param startKey first key in region
- * @param endKey end of key range
- * @throws IllegalArgumentException
- */
- UnmodifyableHRegionInfo(final HTableDescriptor tableDesc,
- final byte [] startKey, final byte [] endKey)
- throws IllegalArgumentException {
- super(new UnmodifyableHTableDescriptor(tableDesc), startKey, endKey, false);
- }
-
- /*
- * Construct HRegionInfo with explicit parameters
- *
- * @param tableDesc the table descriptor
- * @param startKey first key in region
- * @param endKey end of key range
- * @param split true if this region has split and we have daughter regions
- * regions that may or may not hold references to this region.
- * @throws IllegalArgumentException
- */
- UnmodifyableHRegionInfo(HTableDescriptor tableDesc,
- final byte [] startKey, final byte [] endKey, final boolean split)
- throws IllegalArgumentException {
- super(new UnmodifyableHTableDescriptor(tableDesc), startKey, endKey, split);
- }
-
/*
* Creates an unmodifyable copy of an HRegionInfo
*
* @param info
*/
UnmodifyableHRegionInfo(HRegionInfo info) {
- super(new UnmodifyableHTableDescriptor(info.getTableDesc()),
- info.getStartKey(), info.getEndKey(), info.isSplit());
+ super(info);
+ this.tableDesc = new UnmodifyableHTableDescriptor(info.getTableDesc());
}
/**
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/UnmodifyableHTableDescriptor.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/UnmodifyableHTableDescriptor.java?rev=663350&r1=663349&r2=663350&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/UnmodifyableHTableDescriptor.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/UnmodifyableHTableDescriptor.java Wed Jun 4 12:24:40 2008
@@ -26,38 +26,6 @@
class UnmodifyableHTableDescriptor extends HTableDescriptor {
/*
- * Constructs an empty object.
- * For deserializing an HTableDescriptor instance only.
- */
- UnmodifyableHTableDescriptor() {
- super();
- }
-
- /*
- * Constructor.
- * @param name Table name.
- * @throws IllegalArgumentException if passed a table name
- * that is made of other than 'word' characters, underscore or period: i.e.
- * <code>[a-zA-Z_0-9.].
- * @see <a href="HADOOP-1581">HADOOP-1581 HBASE: Un-openable tablename bug</a>
- */
- UnmodifyableHTableDescriptor(final String name) {
- this(Bytes.toBytes(name));
- }
-
- /*
- * Constructor.
- * @param name Table name.
- * @throws IllegalArgumentException if passed a table name
- * that is made of other than 'word' characters, underscore or period: i.e.
- * <code>[a-zA-Z_0-9.].
- * @see <a href="HADOOP-1581">HADOOP-1581 HBASE: Un-openable tablename bug</a>
- */
- UnmodifyableHTableDescriptor(final byte [] name) {
- super(name);
- }
-
- /*
* Create an unmodifyable copy of an HTableDescriptor
* @param desc
*/