HBASE-883 Secondary indices; remove unused comparators

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@718803 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-11-18 23:51:07 +00:00
parent 7525d8ff53
commit 3407263f66
2 changed files with 1 additions and 49 deletions

View File

@ -529,9 +529,6 @@ public class HStoreKey implements WritableComparable<HStoreKey> {
if(rowCompare == 0)
rowCompare = Bytes.compareTo(keysA[1], KeysB[1]);
return rowCompare;
}
if (regionInfo != null && regionInfo.getTableDesc().getRowKeyComparator() != null) {
return regionInfo.getTableDesc().getRowKeyComparator().compare(rowA, rowB);
}
return Bytes.compareTo(rowA, rowB);
}

View File

@ -19,12 +19,8 @@
*/
package org.apache.hadoop.hbase;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
@ -36,7 +32,6 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.client.tableindexed.IndexSpecification;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.io.ObjectWritable;
import org.apache.hadoop.io.WritableComparable;
/**
@ -431,47 +426,7 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> {
setValue(MEMCACHE_FLUSHSIZE_KEY,
Bytes.toBytes(Integer.toString(memcacheFlushSize)));
}
public void setRowKeyComparator(WritableComparator<byte[]> newComparator) {
if (newComparator == null) {
return;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
HBaseConfiguration conf = new HBaseConfiguration();
try {
ObjectWritable.writeObject(dos, newComparator, WritableComparator.class, conf);
dos.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
setValue(ROW_KEY_COMPARATOR.getBytes(), bos.toByteArray());
this.comparator = newComparator;
}
private WritableComparator<byte[]> comparator = null;
public WritableComparator<byte[]> getRowKeyComparator() {
if (comparator != null) {
return comparator;
}
byte[] bytes = getValue(ROW_KEY_COMPARATOR.getBytes());
if (bytes == null) {
return null;
}
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
DataInputStream in = new DataInputStream(bis);
HBaseConfiguration conf = new HBaseConfiguration();
try {
comparator = (WritableComparator<byte[]>) ObjectWritable.readObject(in, conf);
} catch (IOException e) {
throw new RuntimeException(e);
}
return comparator;
}
public Collection<IndexSpecification> getIndexes() {
return indexes.values();
}
@ -708,4 +663,4 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> {
new HColumnDescriptor(HConstants.COLUMN_FAMILY_HISTORIAN,
HConstants.ALL_VERSIONS, HColumnDescriptor.CompressionType.NONE,
false, false, Integer.MAX_VALUE, HConstants.WEEK_IN_SECONDS, false)});
}
}