HBASE-3155 HFile.appendMetaBlock() uses wrong comparator

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1027959 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-10-27 13:44:30 +00:00
parent f9fda11ec0
commit d95e8f964d
2 changed files with 8 additions and 6 deletions

View File

@ -617,6 +617,8 @@ Release 0.21.0 - Unreleased
timeout handling but nothing happens timeout handling but nothing happens
HBASE-3158 Bloom File Writes Broken if keySize is large HBASE-3158 Bloom File Writes Broken if keySize is large
(Nicolas Spiegelberg via Stack) (Nicolas Spiegelberg via Stack)
HBASE-3155 HFile.appendMetaBlock() uses wrong comparator
(Nicolas Spiegelberg via Stack)
IMPROVEMENTS IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable HBASE-1760 Cleanup TODOs in HTable

View File

@ -218,7 +218,7 @@ public class HFile {
private long valuelength = 0; private long valuelength = 0;
// Used to ensure we write in order. // Used to ensure we write in order.
private final RawComparator<byte []> rawComparator; private final RawComparator<byte []> comparator;
// A stream made per block written. // A stream made per block written.
private DataOutputStream out; private DataOutputStream out;
@ -338,7 +338,7 @@ public class HFile {
this.outputStream = ostream; this.outputStream = ostream;
this.closeOutputStream = false; this.closeOutputStream = false;
this.blocksize = blocksize; this.blocksize = blocksize;
this.rawComparator = c == null? Bytes.BYTES_RAWCOMPARATOR: c; this.comparator = c == null? Bytes.BYTES_RAWCOMPARATOR: c;
this.name = this.outputStream.toString(); this.name = this.outputStream.toString();
this.compressAlgo = compress == null? this.compressAlgo = compress == null?
DEFAULT_COMPRESSION_ALGORITHM: compress; DEFAULT_COMPRESSION_ALGORITHM: compress;
@ -440,8 +440,8 @@ public class HFile {
for (i = 0; i < metaNames.size(); ++i) { for (i = 0; i < metaNames.size(); ++i) {
// stop when the current key is greater than our own // stop when the current key is greater than our own
byte[] cur = metaNames.get(i); byte[] cur = metaNames.get(i);
if (this.rawComparator.compare(cur, 0, cur.length, key, 0, key.length) if (Bytes.BYTES_RAWCOMPARATOR.compare(cur, 0, cur.length,
> 0) { key, 0, key.length) > 0) {
break; break;
} }
} }
@ -571,7 +571,7 @@ public class HFile {
MAXIMUM_KEY_LENGTH); MAXIMUM_KEY_LENGTH);
} }
if (this.lastKeyBuffer != null) { if (this.lastKeyBuffer != null) {
int keyComp = this.rawComparator.compare(this.lastKeyBuffer, this.lastKeyOffset, int keyComp = this.comparator.compare(this.lastKeyBuffer, this.lastKeyOffset,
this.lastKeyLength, key, offset, length); this.lastKeyLength, key, offset, length);
if (keyComp > 0) { if (keyComp > 0) {
throw new IOException("Added a key not lexically larger than" + throw new IOException("Added a key not lexically larger than" +
@ -682,7 +682,7 @@ public class HFile {
appendFileInfo(this.fileinfo, FileInfo.AVG_VALUE_LEN, appendFileInfo(this.fileinfo, FileInfo.AVG_VALUE_LEN,
Bytes.toBytes(avgValueLen), false); Bytes.toBytes(avgValueLen), false);
appendFileInfo(this.fileinfo, FileInfo.COMPARATOR, appendFileInfo(this.fileinfo, FileInfo.COMPARATOR,
Bytes.toBytes(this.rawComparator.getClass().getName()), false); Bytes.toBytes(this.comparator.getClass().getName()), false);
long pos = o.getPos(); long pos = o.getPos();
this.fileinfo.write(o); this.fileinfo.write(o);
return pos; return pos;