HBASE-691 get* and getScanner are different in how they treat column parameter
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@668830 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
132a644260
commit
542bff9b3b
|
@ -54,6 +54,7 @@ Hbase Change Log
|
|||
reading performance after break it (LN via Stack)
|
||||
HBASE-686 MemcacheScanner didn't return the first row(if it exists),
|
||||
because HScannerInterface's output incorrect (LN via Jim Kellerman)
|
||||
HBASE-691 get* and getScanner are different in how they treat column parameter
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-559 MR example job to count table rows
|
||||
|
|
|
@ -178,7 +178,16 @@ public class HTableDescriptor implements WritableComparable {
|
|||
* @return true if the table contains the specified family name
|
||||
*/
|
||||
public boolean hasFamily(final byte [] c) {
|
||||
int index = HStoreKey.getFamilyDelimiterIndex(c);
|
||||
return hasFamily(c, HStoreKey.getFamilyDelimiterIndex(c));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if this table contains the given column family
|
||||
* @param c Family name or column name.
|
||||
* @param index Index to column family delimiter
|
||||
* @return true if the table contains the specified family name
|
||||
*/
|
||||
public boolean hasFamily(final byte [] c, final int index) {
|
||||
// If index is -1, then presume we were passed a column family name minus
|
||||
// the colon delimiter.
|
||||
return families.containsKey(Bytes.mapKey(c, index == -1? c.length: index));
|
||||
|
@ -191,7 +200,7 @@ public class HTableDescriptor implements WritableComparable {
|
|||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return HColumnDescriptor.NAME + " => '" + Bytes.toString(this.name) +
|
||||
return HConstants.NAME + " => '" + Bytes.toString(this.name) +
|
||||
"', " + FAMILIES + " => " + this.families.values();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
import org.apache.hadoop.fs.FileStatus;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.hbase.ColumnNameParseException;
|
||||
import org.apache.hadoop.hbase.DroppedSnapshotException;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
|
@ -1141,6 +1142,12 @@ public class HRegion implements HConstants {
|
|||
public Map<byte [], Cell> getFull(final byte [] row,
|
||||
final Set<byte []> columns, final long ts)
|
||||
throws IOException {
|
||||
// Check columns passed
|
||||
if (columns != null) {
|
||||
for (byte [] column: columns) {
|
||||
checkColumn(column);
|
||||
}
|
||||
}
|
||||
HStoreKey key = new HStoreKey(row, ts);
|
||||
Integer lid = obtainRowLock(row);
|
||||
try {
|
||||
|
@ -1603,11 +1610,18 @@ public class HRegion implements HConstants {
|
|||
* @throws NoSuchColumnFamilyException
|
||||
*/
|
||||
private void checkColumn(final byte [] columnName)
|
||||
throws NoSuchColumnFamilyException {
|
||||
throws NoSuchColumnFamilyException, ColumnNameParseException {
|
||||
if (columnName == null) {
|
||||
return;
|
||||
}
|
||||
if (!regionInfo.getTableDesc().hasFamily(columnName)) {
|
||||
|
||||
int index = HStoreKey.getFamilyDelimiterIndex(columnName);
|
||||
if (index <= 0) {
|
||||
throw new ColumnNameParseException(Bytes.toString(columnName) +
|
||||
" is missing column family delimiter '" +
|
||||
HStoreKey.COLUMN_FAMILY_DELIMITER + "'");
|
||||
}
|
||||
if (!regionInfo.getTableDesc().hasFamily(columnName, index)) {
|
||||
throw new NoSuchColumnFamilyException("Column family on " +
|
||||
Bytes.toString(columnName) + " does not exist in region " + this
|
||||
+ " in table " + regionInfo.getTableDesc());
|
||||
|
|
|
@ -993,8 +993,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
public HRegionInfo getRegionInfo(final byte [] regionName)
|
||||
throws NotServingRegionException {
|
||||
|
||||
throws NotServingRegionException {
|
||||
requestCount.incrementAndGet();
|
||||
return getRegion(regionName).getRegionInfo();
|
||||
}
|
||||
|
@ -1006,7 +1005,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
|
|||
checkOpen();
|
||||
requestCount.incrementAndGet();
|
||||
try {
|
||||
return getRegion(regionName).get(row, column);
|
||||
return getRegion(regionName).get(row, column);
|
||||
} catch (IOException e) {
|
||||
checkFileSystem();
|
||||
throw e;
|
||||
|
|
Loading…
Reference in New Issue