HADOOP-2261 HTable.abort no longer throws exception if there is no active update.
HADOOP-2287 Make hbase unit tests take less time to complete. HADOOP-2262 Retry n times instead of n**2 times. git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@599138 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3bff065d34
commit
72414e6c91
|
@ -51,9 +51,10 @@ Trunk (unreleased changes)
|
||||||
HADOOP-2139 (phase 2) Make region server more event driven
|
HADOOP-2139 (phase 2) Make region server more event driven
|
||||||
HADOOP-2289 Useless efforts of looking for the non-existant table in select
|
HADOOP-2289 Useless efforts of looking for the non-existant table in select
|
||||||
command.
|
command.
|
||||||
HADOOP-2262 HADOOP-2261 fail fast on non-existing table, change abort to
|
|
||||||
function after commit even if commit was successful
|
|
||||||
HADOOP-2257 Show a total of all requests and regions on the web ui
|
HADOOP-2257 Show a total of all requests and regions on the web ui
|
||||||
|
HADOOP-2261 HTable.abort no longer throws exception if there is no active update.
|
||||||
|
HADOOP-2287 Make hbase unit tests take less time to complete.
|
||||||
|
HADOOP-2262 Retry n times instead of n**2 times.
|
||||||
|
|
||||||
Release 0.15.1
|
Release 0.15.1
|
||||||
Branch 0.15
|
Branch 0.15
|
||||||
|
|
|
@ -503,9 +503,6 @@ public class HConnectionManager implements HConstants {
|
||||||
}
|
}
|
||||||
if (!waited) {
|
if (!waited) {
|
||||||
try {
|
try {
|
||||||
for (int tries = 0; tries < numRetries; tries++) {
|
|
||||||
boolean success = true; // assume this works
|
|
||||||
|
|
||||||
SortedMap<Text, HRegionLocation> metaServers =
|
SortedMap<Text, HRegionLocation> metaServers =
|
||||||
this.tablesToServers.get(META_TABLE_NAME);
|
this.tablesToServers.get(META_TABLE_NAME);
|
||||||
if (metaServers == null) {
|
if (metaServers == null) {
|
||||||
|
@ -515,22 +512,9 @@ public class HConnectionManager implements HConstants {
|
||||||
metaServers = metaServers.tailMap(firstMetaRegion);
|
metaServers = metaServers.tailMap(firstMetaRegion);
|
||||||
|
|
||||||
for (HRegionLocation t: metaServers.values()) {
|
for (HRegionLocation t: metaServers.values()) {
|
||||||
try {
|
|
||||||
srvrs.putAll(scanOneMetaRegion(t, tableName));
|
srvrs.putAll(scanOneMetaRegion(t, tableName));
|
||||||
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
if (tries < numRetries - 1) {
|
|
||||||
metaServers = findServersForTable(META_TABLE_NAME);
|
|
||||||
success = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (success) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
synchronized (this.tablesBeingLocated) {
|
synchronized (this.tablesBeingLocated) {
|
||||||
// Wake up the threads waiting for us to find the table
|
// Wake up the threads waiting for us to find the table
|
||||||
|
@ -738,9 +722,6 @@ public class HConnectionManager implements HConstants {
|
||||||
regionInfo, new HServerAddress(serverAddress)));
|
regionInfo, new HServerAddress(serverAddress)));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (e instanceof TableNotFoundException) {
|
|
||||||
throw e; // don't retry
|
|
||||||
}
|
|
||||||
if (tries == numRetries - 1) { // no retries left
|
if (tries == numRetries - 1) { // no retries left
|
||||||
if (e instanceof RemoteException) {
|
if (e instanceof RemoteException) {
|
||||||
e = RemoteExceptionHandler.decodeRemoteException((RemoteException) e);
|
e = RemoteExceptionHandler.decodeRemoteException((RemoteException) e);
|
||||||
|
|
|
@ -1296,6 +1296,8 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
||||||
String serverName = serverInfo.getServerAddress().toString().trim();
|
String serverName = serverInfo.getServerAddress().toString().trim();
|
||||||
long serverLabel = getServerLabel(serverName);
|
long serverLabel = getServerLabel(serverName);
|
||||||
if (msgs.length > 0 && msgs[0].getMsg() == HMsg.MSG_REPORT_EXITING) {
|
if (msgs.length > 0 && msgs[0].getMsg() == HMsg.MSG_REPORT_EXITING) {
|
||||||
|
synchronized (serversToServerInfo) {
|
||||||
|
try {
|
||||||
// HRegionServer is shutting down. Cancel the server's lease.
|
// HRegionServer is shutting down. Cancel the server's lease.
|
||||||
// Note that canceling the server's lease takes care of updating
|
// Note that canceling the server's lease takes care of updating
|
||||||
// serversToServerInfo, etc.
|
// serversToServerInfo, etc.
|
||||||
|
@ -1329,6 +1331,10 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
||||||
// We don't need to return anything to the server because it isn't
|
// We don't need to return anything to the server because it isn't
|
||||||
// going to do any more work.
|
// going to do any more work.
|
||||||
return new HMsg[0];
|
return new HMsg[0];
|
||||||
|
} finally {
|
||||||
|
serversToServerInfo.notifyAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (closed.get()) {
|
if (closed.get()) {
|
||||||
|
@ -1434,9 +1440,6 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
synchronized (serversToServerInfo) {
|
|
||||||
serversToServerInfo.notifyAll();
|
|
||||||
}
|
|
||||||
return leaseCancelled;
|
return leaseCancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -574,6 +574,32 @@ public class HTable implements HConstants {
|
||||||
* call to commit() returns. A call to abort() will abandon any updates in
|
* call to commit() returns. A call to abort() will abandon any updates in
|
||||||
* progress.
|
* progress.
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
|
* Example:
|
||||||
|
* <br>
|
||||||
|
* <pre><span style="font-family: monospace;">
|
||||||
|
* long lockid = table.startUpdate(new Text(article.getName()));
|
||||||
|
* for (File articleInfo: article.listFiles(new NonDirectories())) {
|
||||||
|
* String article = null;
|
||||||
|
* try {
|
||||||
|
* DataInputStream in = new DataInputStream(new FileInputStream(articleInfo));
|
||||||
|
* article = in.readUTF();
|
||||||
|
* } catch (IOException e) {
|
||||||
|
* // Input error - abandon update
|
||||||
|
* table.abort(lockid);
|
||||||
|
* throw e;
|
||||||
|
* }
|
||||||
|
* try {
|
||||||
|
* table.put(lockid, columnName(articleInfo.getName()), article.getBytes());
|
||||||
|
* } catch (RuntimeException e) {
|
||||||
|
* // Put failed - abandon update
|
||||||
|
* table.abort(lockid);
|
||||||
|
* throw e;
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* table.commit(lockid);
|
||||||
|
* </span></pre>
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* @param row Name of row to start update against. Note, choose row names
|
* @param row Name of row to start update against. Note, choose row names
|
||||||
* with care. Rows are sorted lexicographically (comparison is done
|
* with care. Rows are sorted lexicographically (comparison is done
|
||||||
|
@ -686,7 +712,12 @@ public class HTable implements HConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abort a row mutation
|
* Abort a row mutation.
|
||||||
|
*
|
||||||
|
* This method should be called only when an update has been started and it
|
||||||
|
* is determined that the update should not be committed.
|
||||||
|
*
|
||||||
|
* Releases resources being held by the update in progress.
|
||||||
*
|
*
|
||||||
* @param lockid lock id returned from startUpdate
|
* @param lockid lock id returned from startUpdate
|
||||||
*/
|
*/
|
||||||
|
@ -699,12 +730,16 @@ public class HTable implements HConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalize a row mutation
|
* Finalize a row mutation.
|
||||||
|
*
|
||||||
* When this method is specified, we pass the server a value that says use
|
* When this method is specified, we pass the server a value that says use
|
||||||
* the 'latest' timestamp. If we are doing a put, on the server-side, cells
|
* the 'latest' timestamp. If we are doing a put, on the server-side, cells
|
||||||
* will be given the servers's current timestamp. If the we are commiting
|
* will be given the servers's current timestamp. If the we are commiting
|
||||||
* deletes, then delete removes the most recently modified cell of stipulated
|
* deletes, then delete removes the most recently modified cell of stipulated
|
||||||
* column.
|
* column.
|
||||||
|
*
|
||||||
|
* @see #commit(long, long)
|
||||||
|
*
|
||||||
* @param lockid lock id returned from startUpdate
|
* @param lockid lock id returned from startUpdate
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@ -713,7 +748,8 @@ public class HTable implements HConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalize a row mutation
|
* Finalize a row mutation and release any resources associated with the update.
|
||||||
|
*
|
||||||
* @param lockid lock id returned from startUpdate
|
* @param lockid lock id returned from startUpdate
|
||||||
* @param timestamp time to associate with the change
|
* @param timestamp time to associate with the change
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
|
Loading…
Reference in New Issue