Index: src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (revision 1085669) +++ src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (working copy) @@ -1188,6 +1188,8 @@ HServerAddress [] lastServers = new HServerAddress[results.length]; List workingList = new ArrayList(list); boolean retry = true; + // count that helps presize actions array + int actionCount = 0; Throwable singleRowCause = null; for (int tries = 0; tries < numRetries && retry; ++tries) { @@ -1278,6 +1280,7 @@ // order), so they can be retried. retry = false; workingList.clear(); + actionCount = 0; for (int i = 0; i < results.length; i++) { // if null (fail) or instanceof Throwable && not instanceof DNRIOE // then retry that row. else dont. @@ -1286,11 +1289,14 @@ !(results[i] instanceof DoNotRetryIOException))) { retry = true; - + actionCount++; Row row = list.get(i); workingList.add(row); deleteCachedLocation(tableName, row.getRow()); } else { + if (results[i] != null && results[i] instanceof Throwable) { + actionCount++; + } // add null to workingList, so the order remains consistent with the original list argument. workingList.add(null); } @@ -1305,9 +1311,9 @@ } - List exceptions = new ArrayList(); - List actions = new ArrayList(); - List addresses = new ArrayList(); + List exceptions = new ArrayList(actionCount); + List actions = new ArrayList(actionCount); + List addresses = new ArrayList(actionCount); for (int i = 0 ; i < results.length; i++) { if (results[i] == null || results[i] instanceof Throwable) {