You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by mb...@apache.org on 2012/05/02 22:51:13 UTC
svn commit: r1333193 -
/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
Author: mbautin
Date: Wed May 2 20:51:12 2012
New Revision: 1333193
URL: http://svn.apache.org/viewvc?rev=1333193&view=rev
Log:
[master] Misleading exceptions for table creation
Author: liyintang
Summary:
There is an issue in puma cluster that user cannot create table since there is NPE in the block placement policy. However, the user keep getting the misleading exceptions, table existing exceptions.
The reason is because there is a retry loop for table creation and once the master retries the table creation operation, it will naturally throw a table existing exception.
In current code base, even though there is a retry logic, master usually can create the table in one pass. Otherwise, the user will get the table existing exception. Also it didn't make sense to retry the table creation operation without any cleanup. I feel we can just simply remove the retry logic here.
Test Plan: running all the unit tests
Reviewers: kannan, mbautin
Reviewed By: kannan
CC: hbase-eng@
Differential Revision: https://phabricator.fb.com/D455459
Modified:
hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1333193&r1=1333192&r2=1333193&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Wed May 2 20:51:12 2012
@@ -1307,27 +1307,23 @@ public class HMaster extends Thread impl
startKey = endKey;
}
}
- for (int tries = 0; tries < this.numRetries; tries++) {
- try {
- // We can not create a table unless meta regions have already been
- // assigned and scanned.
- if (!this.regionManager.areAllMetaRegionsOnline()) {
- throw new NotAllMetaRegionsOnlineException();
- }
- if (!this.serverManager.hasEnoughRegionServers()) {
- throw new IOException("not enough servers to create table yet");
- }
- createTable(newRegions);
- LOG.info("created table " + desc.getNameAsString());
- break;
- } catch (TableExistsException e) {
- throw e;
- } catch (IOException e) {
- if (tries == this.numRetries - 1) {
- throw RemoteExceptionHandler.checkIOException(e);
- }
- this.sleeper.sleep();
- }
+ try {
+ // We can not create a table unless meta regions have already been
+ // assigned and scanned.
+ if (!this.regionManager.areAllMetaRegionsOnline()) {
+ throw new NotAllMetaRegionsOnlineException();
+ }
+ if (!this.serverManager.hasEnoughRegionServers()) {
+ throw new IOException("not enough servers to create table yet");
+ }
+ createTable(newRegions);
+ LOG.info("Succeeded in creating table " + desc.getNameAsString());
+ } catch (TableExistsException e) {
+ throw e;
+ } catch (IOException e) {
+ LOG.error("Cannot create table " + desc.getNameAsString() +
+ " because of " + e.toString());
+ throw RemoteExceptionHandler.checkIOException(e);
}
}