HBASE-805 Remove unnecessary getRow overloads in HRS (Jonathan Gray via Jim Kellerman)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@684054 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Kellerman 2008-08-08 18:55:46 +00:00
parent 8124fa7f7c
commit fa86731a5b
4 changed files with 1853 additions and 1895 deletions

View File

@ -4,6 +4,9 @@ Release 0.3.0 - Unreleased
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES
BUG FIXES BUG FIXES
HBASE-805 Remove unnecessary getRow overloads in HRS (Jonathan Gray via
Jim Kellerman)
IMPROVEMENTS IMPROVEMENTS
HBASE-801 When a table haven't disable, shell could response in a "user HBASE-801 When a table haven't disable, shell could response in a "user
friendly" way. friendly" way.

View File

@ -554,14 +554,7 @@ public class HTable {
*/ */
public RowResult getRow(final byte [] row, final long ts) public RowResult getRow(final byte [] row, final long ts)
throws IOException { throws IOException {
return connection.getRegionServerWithRetries( return getRow(row,null,ts);
new ServerCallable<RowResult>(connection, tableName, row) {
public RowResult call() throws IOException {
return server.getRow(location.getRegionInfo().getRegionName(), row,
ts);
}
}
);
} }
/** /**

View File

@ -1,234 +1,210 @@
/** /**
* Copyright 2007 The Apache Software Foundation * Copyright 2007 The Apache Software Foundation
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.hbase.ipc; package org.apache.hadoop.hbase.ipc;
import java.io.IOException; import java.io.IOException;
import org.apache.hadoop.hbase.filter.RowFilterInterface; import org.apache.hadoop.hbase.filter.RowFilterInterface;
import org.apache.hadoop.hbase.io.BatchUpdate; import org.apache.hadoop.hbase.io.BatchUpdate;
import org.apache.hadoop.hbase.io.Cell; import org.apache.hadoop.hbase.io.Cell;
import org.apache.hadoop.hbase.io.RowResult; import org.apache.hadoop.hbase.io.RowResult;
import org.apache.hadoop.ipc.VersionedProtocol; import org.apache.hadoop.ipc.VersionedProtocol;
import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.NotServingRegionException; import org.apache.hadoop.hbase.NotServingRegionException;
/** /**
* Clients interact with HRegionServers using a handle to the HRegionInterface. * Clients interact with HRegionServers using a handle to the HRegionInterface.
*/ */
public interface HRegionInterface extends VersionedProtocol { public interface HRegionInterface extends VersionedProtocol {
/** /**
* Protocol version. * Protocol version.
* Upped to 3 when we went from Text to byte arrays for row and column names. * Upped to 3 when we went from Text to byte arrays for row and column names.
*/ */
public static final long versionID = 3L; public static final long versionID = 3L;
/** /**
* Get metainfo about an HRegion * Get metainfo about an HRegion
* *
* @param regionName name of the region * @param regionName name of the region
* @return HRegionInfo object for region * @return HRegionInfo object for region
* @throws NotServingRegionException * @throws NotServingRegionException
*/ */
public HRegionInfo getRegionInfo(final byte [] regionName) public HRegionInfo getRegionInfo(final byte [] regionName)
throws NotServingRegionException; throws NotServingRegionException;
/** /**
* Retrieve a single value from the specified region for the specified row * Retrieve a single value from the specified region for the specified row
* and column keys * and column keys
* *
* @param regionName name of region * @param regionName name of region
* @param row row key * @param row row key
* @param column column key * @param column column key
* @return alue for that region/row/column * @return alue for that region/row/column
* @throws IOException * @throws IOException
*/ */
public Cell get(final byte [] regionName, final byte [] row, final byte [] column) public Cell get(final byte [] regionName, final byte [] row, final byte [] column)
throws IOException; throws IOException;
/** /**
* Get the specified number of versions of the specified row and column * Get the specified number of versions of the specified row and column
* *
* @param regionName region name * @param regionName region name
* @param row row key * @param row row key
* @param column column key * @param column column key
* @param numVersions number of versions to return * @param numVersions number of versions to return
* @return array of values * @return array of values
* @throws IOException * @throws IOException
*/ */
public Cell[] get(final byte [] regionName, final byte [] row, public Cell[] get(final byte [] regionName, final byte [] row,
final byte [] column, final int numVersions) final byte [] column, final int numVersions)
throws IOException; throws IOException;
/** /**
* Get the specified number of versions of the specified row and column with * Get the specified number of versions of the specified row and column with
* the specified timestamp. * the specified timestamp.
* *
* @param regionName region name * @param regionName region name
* @param row row key * @param row row key
* @param column column key * @param column column key
* @param timestamp timestamp * @param timestamp timestamp
* @param numVersions number of versions to return * @param numVersions number of versions to return
* @return array of values * @return array of values
* @throws IOException * @throws IOException
*/ */
public Cell[] get(final byte [] regionName, final byte [] row, public Cell[] get(final byte [] regionName, final byte [] row,
final byte [] column, final long timestamp, final int numVersions) final byte [] column, final long timestamp, final int numVersions)
throws IOException; throws IOException;
/** /**
* Get all the data for the specified row at a given timestamp * Return all the data for the row that matches <i>row</i> exactly,
* * or the one that immediately preceeds it.
* @param regionName region name *
* @param row row key * @param regionName region name
* @return map of values * @param row row key
* @throws IOException * @return map of values
*/ * @throws IOException
public RowResult getRow(final byte [] regionName, final byte [] row, */
final long ts) public RowResult getClosestRowBefore(final byte [] regionName,
throws IOException; final byte [] row)
throws IOException;
/**
* Return all the data for the row that matches <i>row</i> exactly, /**
* or the one that immediately preceeds it. * Get selected columns for the specified row at a given timestamp.
* *
* @param regionName region name * @param regionName region name
* @param row row key * @param row row key
* @return map of values * @return map of values
* @throws IOException * @throws IOException
*/ */
public RowResult getClosestRowBefore(final byte [] regionName, public RowResult getRow(final byte [] regionName, final byte [] row,
final byte [] row) final byte[][] columns, final long ts)
throws IOException; throws IOException;
/** /**
* Get selected columns for the specified row at a given timestamp. * Applies a batch of updates via one RPC
* *
* @param regionName region name * @param regionName name of the region to update
* @param row row key * @param b BatchUpdate
* @return map of values * @throws IOException
* @throws IOException */
*/ public void batchUpdate(final byte [] regionName, final BatchUpdate b)
public RowResult getRow(final byte [] regionName, final byte [] row, throws IOException;
final byte[][] columns, final long ts)
throws IOException; /**
* Delete all cells that match the passed row and column and whose
/** * timestamp is equal-to or older than the passed timestamp.
* Get selected columns for the specified row at the latest timestamp. *
* * @param regionName region name
* @param regionName region name * @param row row key
* @param row row key * @param column column key
* @return map of values * @param timestamp Delete all entries that have this timestamp or older
* @throws IOException * @throws IOException
*/ */
public RowResult getRow(final byte [] regionName, final byte [] row, public void deleteAll(byte [] regionName, byte [] row, byte [] column,
final byte[][] columns) long timestamp)
throws IOException; throws IOException;
/** /**
* Applies a batch of updates via one RPC * Delete all cells that match the passed row and whose
* * timestamp is equal-to or older than the passed timestamp.
* @param regionName name of the region to update *
* @param b BatchUpdate * @param regionName region name
* @throws IOException * @param row row key
*/ * @param timestamp Delete all entries that have this timestamp or older
public void batchUpdate(final byte [] regionName, final BatchUpdate b) * @throws IOException
throws IOException; */
public void deleteAll(byte [] regionName, byte [] row, long timestamp)
/** throws IOException;
* Delete all cells that match the passed row and column and whose
* timestamp is equal-to or older than the passed timestamp. /**
* * Delete all cells for a row with matching column family with timestamps
* @param regionName region name * less than or equal to <i>timestamp</i>.
* @param row row key *
* @param column column key * @param regionName The name of the region to operate on
* @param timestamp Delete all entries that have this timestamp or older * @param row The row to operate on
* @throws IOException * @param family The column family to match
*/ * @param timestamp Timestamp to match
public void deleteAll(byte [] regionName, byte [] row, byte [] column, */
long timestamp) public void deleteFamily(byte [] regionName, byte [] row, byte [] family,
throws IOException; long timestamp)
throws IOException;
/**
* Delete all cells that match the passed row and whose
* timestamp is equal-to or older than the passed timestamp. //
* // remote scanner interface
* @param regionName region name //
* @param row row key
* @param timestamp Delete all entries that have this timestamp or older /**
* @throws IOException * Opens a remote scanner with a RowFilter.
*/ *
public void deleteAll(byte [] regionName, byte [] row, long timestamp) * @param regionName name of region to scan
throws IOException; * @param columns columns to scan. If column name is a column family, all
* columns of the specified column family are returned. Its also possible
/** * to pass a regex for column family name. A column name is judged to be
* Delete all cells for a row with matching column family with timestamps * regex if it contains at least one of the following characters:
* less than or equal to <i>timestamp</i>. * <code>\+|^&*$[]]}{)(</code>.
* * @param startRow starting row to scan
* @param regionName The name of the region to operate on * @param timestamp only return values whose timestamp is <= this value
* @param row The row to operate on * @param filter RowFilter for filtering results at the row-level.
* @param family The column family to match *
* @param timestamp Timestamp to match * @return scannerId scanner identifier used in other calls
*/ * @throws IOException
public void deleteFamily(byte [] regionName, byte [] row, byte [] family, */
long timestamp) public long openScanner(final byte [] regionName, final byte [][] columns,
throws IOException; final byte [] startRow, long timestamp, RowFilterInterface filter)
throws IOException;
// /**
// remote scanner interface * Get the next set of values
// * @param scannerId clientId passed to openScanner
* @return map of values
/** * @throws IOException
* Opens a remote scanner with a RowFilter. */
* public RowResult next(long scannerId) throws IOException;
* @param regionName name of region to scan
* @param columns columns to scan. If column name is a column family, all /**
* columns of the specified column family are returned. Its also possible * Close a scanner
* to pass a regex for column family name. A column name is judged to be *
* regex if it contains at least one of the following characters: * @param scannerId the scanner id returned by openScanner
* <code>\+|^&*$[]]}{)(</code>. * @throws IOException
* @param startRow starting row to scan */
* @param timestamp only return values whose timestamp is <= this value public void close(long scannerId) throws IOException;
* @param filter RowFilter for filtering results at the row-level.
*
* @return scannerId scanner identifier used in other calls
* @throws IOException
*/
public long openScanner(final byte [] regionName, final byte [][] columns,
final byte [] startRow, long timestamp, RowFilterInterface filter)
throws IOException;
/**
* Get the next set of values
* @param scannerId clientId passed to openScanner
* @return map of values
* @throws IOException
*/
public RowResult next(long scannerId) throws IOException;
/**
* Close a scanner
*
* @param scannerId the scanner id returned by openScanner
* @throws IOException
*/
public void close(long scannerId) throws IOException;
} }