HADOOP-2592 Scanning, a region can let out a row that its not supposed to have
git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@612314 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b78012df61
commit
615fe2bbc7
|
@ -129,6 +129,8 @@ Trunk (unreleased changes)
|
||||||
previously (Bryan Duxbury via Stack)
|
previously (Bryan Duxbury via Stack)
|
||||||
HADOOP-2587 Splits blocked by compactions cause region to be offline for
|
HADOOP-2587 Splits blocked by compactions cause region to be offline for
|
||||||
duration of compaction.
|
duration of compaction.
|
||||||
|
HADOOP-2592 Scanning, a region can let out a row that its not supposed
|
||||||
|
to have
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
HADOOP-2401 Add convenience put method that takes writable
|
HADOOP-2401 Add convenience put method that takes writable
|
||||||
|
|
|
@ -737,7 +737,7 @@ public class HStoreFile implements HConstants {
|
||||||
static class HalfMapFileReader extends BloomFilterMapFile.Reader {
|
static class HalfMapFileReader extends BloomFilterMapFile.Reader {
|
||||||
private final boolean top;
|
private final boolean top;
|
||||||
private final WritableComparable midkey;
|
private final WritableComparable midkey;
|
||||||
private boolean topFirstNextCall = true;
|
private boolean firstNextCall = true;
|
||||||
|
|
||||||
HalfMapFileReader(final FileSystem fs, final String dirName,
|
HalfMapFileReader(final FileSystem fs, final String dirName,
|
||||||
final Configuration conf, final Range r,
|
final Configuration conf, final Range r,
|
||||||
|
@ -791,15 +791,30 @@ public class HStoreFile implements HConstants {
|
||||||
public synchronized WritableComparable getClosest(WritableComparable key,
|
public synchronized WritableComparable getClosest(WritableComparable key,
|
||||||
Writable val)
|
Writable val)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
WritableComparable closest = null;
|
||||||
if (top) {
|
if (top) {
|
||||||
if (key.compareTo(midkey) < 0) {
|
// If top, the lowest possible key is midkey. Do not have to check
|
||||||
return midkey;
|
// what comes back from super getClosest. Will return exact match or
|
||||||
|
// greater.
|
||||||
|
closest = (key.compareTo(this.midkey) < 0)?
|
||||||
|
this.midkey: super.getClosest(key, val);
|
||||||
|
} else {
|
||||||
|
// We're serving bottom of the file.
|
||||||
|
if (key.compareTo(this.midkey) < 0) {
|
||||||
|
// Check key is within range for bottom.
|
||||||
|
closest = super.getClosest(key, val);
|
||||||
|
// midkey was made against largest store file at time of split. Smaller
|
||||||
|
// store files could have anything in them. Check return value is
|
||||||
|
// not beyond the midkey (getClosest returns exact match or next
|
||||||
|
// after).
|
||||||
|
if (closest != null && closest.compareTo(this.midkey) >= 0) {
|
||||||
|
// Don't let this value out.
|
||||||
|
closest = null;
|
||||||
}
|
}
|
||||||
} else if (key.compareTo(midkey) >= 0) {
|
|
||||||
// Contract says return null if EOF.
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
return super.getClosest(key, val);
|
// Else, key is > midkey so let out closest = null.
|
||||||
|
}
|
||||||
|
return closest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
@ -815,19 +830,9 @@ public class HStoreFile implements HConstants {
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean next(WritableComparable key, Writable val)
|
public synchronized boolean next(WritableComparable key, Writable val)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (top && topFirstNextCall) {
|
if (firstNextCall) {
|
||||||
topFirstNextCall = false;
|
firstNextCall = false;
|
||||||
return doFirstNextProcessing(key, val);
|
if (this.top) {
|
||||||
}
|
|
||||||
boolean result = super.next(key, val);
|
|
||||||
if (!top && key.compareTo(midkey) >= 0) {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean doFirstNextProcessing(WritableComparable key, Writable val)
|
|
||||||
throws IOException {
|
|
||||||
// Seek to midkey. Midkey may not exist in this file. That should be
|
// Seek to midkey. Midkey may not exist in this file. That should be
|
||||||
// fine. Then we'll either be positioned at end or start of file.
|
// fine. Then we'll either be positioned at end or start of file.
|
||||||
WritableComparable nearest = getClosest(midkey, val);
|
WritableComparable nearest = getClosest(midkey, val);
|
||||||
|
@ -838,12 +843,19 @@ public class HStoreFile implements HConstants {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
boolean result = super.next(key, val);
|
||||||
|
if (!top && key.compareTo(midkey) >= 0) {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public synchronized void reset() throws IOException {
|
public synchronized void reset() throws IOException {
|
||||||
if (top) {
|
if (top) {
|
||||||
topFirstNextCall = true;
|
firstNextCall = true;
|
||||||
seek(midkey);
|
seek(midkey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue