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)
|
reading performance after break it (LN via Stack)
|
||||||
HBASE-686 MemcacheScanner didn't return the first row(if it exists),
|
HBASE-686 MemcacheScanner didn't return the first row(if it exists),
|
||||||
because HScannerInterface's output incorrect (LN via Jim Kellerman)
|
because HScannerInterface's output incorrect (LN via Jim Kellerman)
|
||||||
|
HBASE-691 get* and getScanner are different in how they treat column parameter
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
HBASE-559 MR example job to count table rows
|
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
|
* @return true if the table contains the specified family name
|
||||||
*/
|
*/
|
||||||
public boolean hasFamily(final byte [] c) {
|
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
|
// If index is -1, then presume we were passed a column family name minus
|
||||||
// the colon delimiter.
|
// the colon delimiter.
|
||||||
return families.containsKey(Bytes.mapKey(c, index == -1? c.length: index));
|
return families.containsKey(Bytes.mapKey(c, index == -1? c.length: index));
|
||||||
|
@ -191,7 +200,7 @@ public class HTableDescriptor implements WritableComparable {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return HColumnDescriptor.NAME + " => '" + Bytes.toString(this.name) +
|
return HConstants.NAME + " => '" + Bytes.toString(this.name) +
|
||||||
"', " + FAMILIES + " => " + this.families.values();
|
"', " + 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.FileStatus;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
|
import org.apache.hadoop.hbase.ColumnNameParseException;
|
||||||
import org.apache.hadoop.hbase.DroppedSnapshotException;
|
import org.apache.hadoop.hbase.DroppedSnapshotException;
|
||||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||||
|
@ -1141,6 +1142,12 @@ public class HRegion implements HConstants {
|
||||||
public Map<byte [], Cell> getFull(final byte [] row,
|
public Map<byte [], Cell> getFull(final byte [] row,
|
||||||
final Set<byte []> columns, final long ts)
|
final Set<byte []> columns, final long ts)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
// Check columns passed
|
||||||
|
if (columns != null) {
|
||||||
|
for (byte [] column: columns) {
|
||||||
|
checkColumn(column);
|
||||||
|
}
|
||||||
|
}
|
||||||
HStoreKey key = new HStoreKey(row, ts);
|
HStoreKey key = new HStoreKey(row, ts);
|
||||||
Integer lid = obtainRowLock(row);
|
Integer lid = obtainRowLock(row);
|
||||||
try {
|
try {
|
||||||
|
@ -1603,11 +1610,18 @@ public class HRegion implements HConstants {
|
||||||
* @throws NoSuchColumnFamilyException
|
* @throws NoSuchColumnFamilyException
|
||||||
*/
|
*/
|
||||||
private void checkColumn(final byte [] columnName)
|
private void checkColumn(final byte [] columnName)
|
||||||
throws NoSuchColumnFamilyException {
|
throws NoSuchColumnFamilyException, ColumnNameParseException {
|
||||||
if (columnName == null) {
|
if (columnName == null) {
|
||||||
return;
|
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 " +
|
throw new NoSuchColumnFamilyException("Column family on " +
|
||||||
Bytes.toString(columnName) + " does not exist in region " + this
|
Bytes.toString(columnName) + " does not exist in region " + this
|
||||||
+ " in table " + regionInfo.getTableDesc());
|
+ " in table " + regionInfo.getTableDesc());
|
||||||
|
|
|
@ -993,8 +993,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public HRegionInfo getRegionInfo(final byte [] regionName)
|
public HRegionInfo getRegionInfo(final byte [] regionName)
|
||||||
throws NotServingRegionException {
|
throws NotServingRegionException {
|
||||||
|
|
||||||
requestCount.incrementAndGet();
|
requestCount.incrementAndGet();
|
||||||
return getRegion(regionName).getRegionInfo();
|
return getRegion(regionName).getRegionInfo();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue