HADOOP-1794 Remove deprecated APIs

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@573088 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Kellerman 2007-09-05 22:35:13 +00:00
parent ea418aebbd
commit 84ef0f95ef
3 changed files with 43 additions and 225 deletions

View File

@ -39,6 +39,7 @@ Trunk (unreleased changes)
filter types
HADOOP-1760 Use new MapWritable and SortedMapWritable classes from
org.apache.hadoop.io
HADOOP-1794 Remove deprecated APIs
HADOOP-1802 Startup scripts should wait until hdfs as cleared 'safe mode'
HADOOP-1835 Updated Documentation for HBase setup/installation
(Izaak Rubin via Stack)

View File

@ -28,10 +28,9 @@ import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.ipc.VersionedProtocol;
/*******************************************************************************
* 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 {
/** initial version */
public static final long versionID = 1L;
@ -100,120 +99,19 @@ public interface HRegionInterface extends VersionedProtocol {
public MapWritable getRow(final Text regionName, final Text row)
throws IOException;
//////////////////////////////////////////////////////////////////////////////
// Start an atomic row insertion/update. No changes are committed until the
// call to commit() returns. A call to abort() will abandon any updates in progress.
//
// Callers to this method are given a lease for each unique lockid; before the
// lease expires, either abort() or commit() must be called. If it is not
// called, the system will automatically call abort() on the client's behalf.
//
// The client can gain extra time with a call to renewLease().
//////////////////////////////////////////////////////////////////////////////
/**
* Start an atomic row insertion/update. No changes are committed until the
* call to commit() returns. A call to abort() will abandon any updates in progress.
*
* Callers to this method are given a lease for each unique lockid; before the
* lease expires, either abort() or commit() must be called. If it is not
* called, the system will automatically call abort() on the client's behalf.
*
* The client can gain extra time with a call to renewLease().
* Start an atomic row insertion or update
*
* @param regionName region name
* @param clientid a unique value to identify the client
* @param row Name of row to start update against.
* @return Row lockid.
* @throws IOException
*
* Deprecated. Use @see {@link #batchUpdate(Text, long, BatchUpdate)} instead.
*/
@Deprecated
public long startUpdate(final Text regionName, final long clientid,
final Text row)
throws IOException;
/**
* Change a value for the specified column
*
* @param regionName region name
* @param clientid a unique value to identify the client
* @param lockid lock id returned from startUpdate
* @param column column whose value is being set
* @param val new value for column
* @throws IOException
*
* Deprecated. Use @see {@link #batchUpdate(Text, long, BatchUpdate)} instead.
*/
@Deprecated
public void put(final Text regionName, final long clientid, final long lockid,
final Text column, final byte [] val)
throws IOException;
/**
* Delete the value for a column
*
* @param regionName region name
* @param clientid a unique value to identify the client
* @param lockid lock id returned from startUpdate
* @param column name of column whose value is to be deleted
* @throws IOException
*
* Deprecated. Use @see {@link #batchUpdate(Text, long, BatchUpdate)} instead.
*/
@Deprecated
public void delete(final Text regionName, final long clientid,
final long lockid, final Text column)
throws IOException;
/**
* Abort a row mutation
*
* @param regionName region name
* @param clientid a unique value to identify the client
* @param lockid lock id returned from startUpdate
* @throws IOException
*
* Deprecated. Use @see {@link #batchUpdate(Text, long, BatchUpdate)} instead.
*/
@Deprecated
public void abort(final Text regionName, final long clientid,
final long lockid)
throws IOException;
/**
* Finalize a row mutation
*
* @param regionName region name
* @param clientid a unique value to identify the client
* @param lockid lock id returned from startUpdate
* @param timestamp the time (in milliseconds to associate with this change)
* @throws IOException
*
* Deprecated. Use @see {@link #batchUpdate(Text, long, BatchUpdate)} instead.
*/
@Deprecated
public void commit(final Text regionName, final long clientid,
final long lockid, final long timestamp)
throws IOException;
/**
* Renew lease on update
* Applies a batch of updates via one RPC
*
* @param lockid lock id returned from startUpdate
* @param clientid a unique value to identify the client
* @param regionName name of the region to update
* @param timestamp the time to be associated with the changes
* @param b BatchUpdate
* @throws IOException
*
* Deprecated. Use @see {@link #batchUpdate(Text, long, BatchUpdate)} instead.
*/
@Deprecated
public void renewLease(long lockid, long clientid) throws IOException;
//////////////////////////////////////////////////////////////////////////////
public void batchUpdate(Text regionName, long timestamp, BatchUpdate b) throws IOException;
//
// remote scanner interface
//////////////////////////////////////////////////////////////////////////////
//
/**
* Opens a remote scanner with a RowFilter.
@ -231,16 +129,6 @@ public interface HRegionInterface extends VersionedProtocol {
long timestamp, RowFilterInterface filter)
throws IOException;
/**
* Applies a batch of updates via one RPC
*
* @param regionName name of the region to update
* @param timestamp the time to be associated with the changes
* @param b BatchUpdate
* @throws IOException
*/
public void batchUpdate(Text regionName, long timestamp, BatchUpdate b) throws IOException;
/**
* Get the next set of values
*

View File

@ -984,26 +984,6 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
return getRegion(regionName).getRegionInfo();
}
/** {@inheritDoc} */
public void batchUpdate(Text regionName, long timestamp, BatchUpdate b)
throws IOException {
requestCount.incrementAndGet();
long clientid = rand.nextLong();
long lockid = startUpdate(regionName, clientid, b.getRow());
for(BatchOperation op: b) {
switch(op.getOp()) {
case BatchOperation.PUT_OP:
put(regionName, clientid, lockid, op.getColumn(), op.getValue());
break;
case BatchOperation.DELETE_OP:
delete(regionName, clientid, lockid, op.getColumn());
break;
}
}
commit(regionName, clientid, lockid, timestamp);
}
/** {@inheritDoc} */
public byte [] get(final Text regionName, final Text row,
final Text column)
@ -1083,102 +1063,51 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
return values;
}
/*
* NOTE: When startUpdate, put, delete, abort, commit and renewLease are
* removed from HRegionInterface, these methods (with the exception of
* renewLease) must remain, as they are called by batchUpdate (renewLease
* can just be removed)
*
* However, the remaining methods can become protected instead of public
* at that point.
*/
/** Create a lease for an update. If it times out, the update is aborted */
private static class RegionListener implements LeaseListener {
private HRegion localRegion;
private long localLockId;
RegionListener(HRegion region, long lockId) {
this.localRegion = region;
this.localLockId = lockId;
}
/** {@inheritDoc} */
public void leaseExpired() {
try {
localRegion.abort(localLockId);
} catch (IOException iex) {
if (iex instanceof RemoteException) {
try {
iex = RemoteExceptionHandler.decodeRemoteException((RemoteException) iex);
} catch (IOException x) {
iex = x;
}
}
LOG.error("", iex);
}
}
}
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
public long startUpdate(Text regionName, long clientid, Text row)
throws IOException {
requestCount.incrementAndGet();
HRegion region = getRegion(regionName);
long lockid = region.startUpdate(row);
this.leases.createLease(clientid, lockid,
new RegionListener(region, lockid));
return lockid;
}
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
public void put(final Text regionName, final long clientid,
final long lockid, final Text column, final byte [] val)
public void batchUpdate(Text regionName, long timestamp, BatchUpdate b)
throws IOException {
requestCount.incrementAndGet();
long lockid = startUpdate(regionName, b.getRow());
for(BatchOperation op: b) {
switch(op.getOp()) {
case BatchOperation.PUT_OP:
put(regionName, lockid, op.getColumn(), op.getValue());
break;
case BatchOperation.DELETE_OP:
delete(regionName, lockid, op.getColumn());
break;
}
}
commit(regionName, lockid, timestamp);
}
protected long startUpdate(Text regionName, Text row)
throws IOException {
HRegion region = getRegion(regionName);
return region.startUpdate(row);
}
protected void put(final Text regionName, final long lockid,
final Text column, final byte [] val) throws IOException {
HRegion region = getRegion(regionName, true);
leases.renewLease(clientid, lockid);
region.put(lockid, column, val);
}
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
public void delete(Text regionName, long clientid, long lockid, Text column)
protected void delete(Text regionName, long lockid, Text column)
throws IOException {
requestCount.incrementAndGet();
HRegion region = getRegion(regionName);
leases.renewLease(clientid, lockid);
region.delete(lockid, column);
}
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
public void abort(Text regionName, long clientid, long lockid)
throws IOException {
requestCount.incrementAndGet();
HRegion region = getRegion(regionName, true);
leases.cancelLease(clientid, lockid);
region.abort(lockid);
}
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
public void commit(Text regionName, final long clientid, final long lockid,
protected void commit(Text regionName, final long lockid,
final long timestamp) throws IOException {
requestCount.incrementAndGet();
HRegion region = getRegion(regionName, true);
leases.cancelLease(clientid, lockid);
region.commit(lockid, timestamp);
}
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
public void renewLease(long lockid, long clientid) throws IOException {
requestCount.incrementAndGet();
leases.renewLease(clientid, lockid);
HRegion region = getRegion(regionName, true);
region.commit(lockid, timestamp);
}
/**