Index: src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java (revision 1090638) +++ src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java (working copy) @@ -1283,6 +1283,29 @@ } @Override + protected long getTimeoutOnRIT() { + // Guesstimate a timeout based on what we have to assign rather than have + // set upper bound. Multiply how long we think a region open takes by + // the maximum regions we have for any one server. + long perRegionOpenTimeGuesstimate = + this.server.getConfiguration().getLong("hbase.bulk.assignment.perregion.open.time", 1000); + int max = 0; + for (Map.Entry> e: + this.bulkPlan.entrySet()) { + int count = e.getValue().size(); + if (count < max) continue; + max = count; + } + long timeout = perRegionOpenTimeGuesstimate * max; + // If we end up at zero, then somethning wrong w/ our math. Use default. + if (timeout == 0) timeout = super.getTimeoutOnRIT(); + LOG.debug("Timeout-on-RIT=" + (timeout / 1000) + + "s; perRegionOpenTimeGuesstimate=" + perRegionOpenTimeGuesstimate + + ", maxRegionsForOneServer=" + max); + return timeout; + } + + @Override protected void populatePool(java.util.concurrent.ExecutorService pool) { for (Map.Entry> e: this.bulkPlan.entrySet()) { pool.execute(new SingleServerBulkAssigner(e.getKey(), e.getValue(),