HBASE-544 filters generate StackOverflowException
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@646031 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
49e0eaf8d9
commit
6410feb071
|
@ -14,6 +14,7 @@ Hbase Change Log
|
||||||
0.0.0.0:60100 rather than relying on conf
|
0.0.0.0:60100 rather than relying on conf
|
||||||
HBASE-507 Use Callable pattern to sleep between retries
|
HBASE-507 Use Callable pattern to sleep between retries
|
||||||
HBASE-564 Don't do a cache flush if there are zero entries in the cache.
|
HBASE-564 Don't do a cache flush if there are zero entries in the cache.
|
||||||
|
HBASE-544 filters generate StackOverflowException
|
||||||
|
|
||||||
NEW FEATURES
|
NEW FEATURES
|
||||||
HBASE-548 Tool to online single region
|
HBASE-548 Tool to online single region
|
||||||
|
|
|
@ -1739,69 +1739,73 @@ public class HRegion implements HConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
@SuppressWarnings("null")
|
||||||
public boolean next(HStoreKey key, SortedMap<Text, byte[]> results)
|
public boolean next(HStoreKey key, SortedMap<Text, byte[]> results)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
boolean moreToFollow = false;
|
boolean moreToFollow = false;
|
||||||
|
|
||||||
// Find the lowest-possible key.
|
do {
|
||||||
|
// Find the lowest-possible key.
|
||||||
|
|
||||||
Text chosenRow = null;
|
Text chosenRow = null;
|
||||||
long chosenTimestamp = -1;
|
long chosenTimestamp = -1;
|
||||||
for (int i = 0; i < this.keys.length; i++) {
|
for (int i = 0; i < this.keys.length; i++) {
|
||||||
if (scanners[i] != null &&
|
if (scanners[i] != null &&
|
||||||
(chosenRow == null ||
|
(chosenRow == null ||
|
||||||
(keys[i].getRow().compareTo(chosenRow) < 0) ||
|
(keys[i].getRow().compareTo(chosenRow) < 0) ||
|
||||||
((keys[i].getRow().compareTo(chosenRow) == 0) &&
|
((keys[i].getRow().compareTo(chosenRow) == 0) &&
|
||||||
(keys[i].getTimestamp() > chosenTimestamp)))) {
|
(keys[i].getTimestamp() > chosenTimestamp)))) {
|
||||||
chosenRow = new Text(keys[i].getRow());
|
chosenRow = new Text(keys[i].getRow());
|
||||||
chosenTimestamp = keys[i].getTimestamp();
|
chosenTimestamp = keys[i].getTimestamp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Store the key and results for each sub-scanner. Merge them as
|
// Store the key and results for each sub-scanner. Merge them as
|
||||||
// appropriate.
|
// appropriate.
|
||||||
if (chosenTimestamp >= 0) {
|
if (chosenTimestamp >= 0) {
|
||||||
// Here we are setting the passed in key with current row+timestamp
|
// Here we are setting the passed in key with current row+timestamp
|
||||||
key.setRow(chosenRow);
|
key.setRow(chosenRow);
|
||||||
key.setVersion(chosenTimestamp);
|
key.setVersion(chosenTimestamp);
|
||||||
key.setColumn(HConstants.EMPTY_TEXT);
|
key.setColumn(HConstants.EMPTY_TEXT);
|
||||||
|
|
||||||
for (int i = 0; i < scanners.length; i++) {
|
for (int i = 0; i < scanners.length; i++) {
|
||||||
if (scanners[i] != null && keys[i].getRow().compareTo(chosenRow) == 0) {
|
if (scanners[i] != null &&
|
||||||
// NOTE: We used to do results.putAll(resultSets[i]);
|
keys[i].getRow().compareTo(chosenRow) == 0) {
|
||||||
// but this had the effect of overwriting newer
|
// NOTE: We used to do results.putAll(resultSets[i]);
|
||||||
// values with older ones. So now we only insert
|
// but this had the effect of overwriting newer
|
||||||
// a result if the map does not contain the key.
|
// values with older ones. So now we only insert
|
||||||
for (Map.Entry<Text, byte[]> e : resultSets[i].entrySet()) {
|
// a result if the map does not contain the key.
|
||||||
if (!results.containsKey(e.getKey())) {
|
for (Map.Entry<Text, byte[]> e : resultSets[i].entrySet()) {
|
||||||
results.put(e.getKey(), e.getValue());
|
if (!results.containsKey(e.getKey())) {
|
||||||
|
results.put(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resultSets[i].clear();
|
||||||
|
if (!scanners[i].next(keys[i], resultSets[i])) {
|
||||||
|
closeScanner(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < scanners.length; i++) {
|
||||||
|
// If the current scanner is non-null AND has a lower-or-equal
|
||||||
|
// row label, then its timestamp is bad. We need to advance it.
|
||||||
|
while ((scanners[i] != null) &&
|
||||||
|
(keys[i].getRow().compareTo(chosenRow) <= 0)) {
|
||||||
resultSets[i].clear();
|
resultSets[i].clear();
|
||||||
if (!scanners[i].next(keys[i], resultSets[i])) {
|
if (!scanners[i].next(keys[i], resultSets[i])) {
|
||||||
closeScanner(i);
|
closeScanner(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < scanners.length; i++) {
|
moreToFollow = chosenTimestamp >= 0;
|
||||||
// If the current scanner is non-null AND has a lower-or-equal
|
if (results == null || results.size() <= 0) {
|
||||||
// row label, then its timestamp is bad. We need to advance it.
|
// If we got no results, then there is no more to follow.
|
||||||
while ((scanners[i] != null) &&
|
moreToFollow = false;
|
||||||
(keys[i].getRow().compareTo(chosenRow) <= 0)) {
|
|
||||||
resultSets[i].clear();
|
|
||||||
if (!scanners[i].next(keys[i], resultSets[i])) {
|
|
||||||
closeScanner(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
} while(filter != null && filter.filterNotNull(results) && moreToFollow);
|
||||||
|
|
||||||
moreToFollow = chosenTimestamp >= 0;
|
|
||||||
if (results == null || results.size() <= 0) {
|
|
||||||
// If we got no results, then there is no more to follow.
|
|
||||||
moreToFollow = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure scanners closed if no more results
|
// Make sure scanners closed if no more results
|
||||||
if (!moreToFollow) {
|
if (!moreToFollow) {
|
||||||
|
@ -1812,11 +1816,6 @@ public class HRegion implements HConstants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter != null && filter.filterNotNull(results)) {
|
|
||||||
LOG.warn("Filter return true on assembled Results in hstore");
|
|
||||||
return moreToFollow == true && this.next(key, results);
|
|
||||||
}
|
|
||||||
|
|
||||||
return moreToFollow;
|
return moreToFollow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue