Skip to content

Commit 737bd2d

Browse files
author
sbarnoud060710
committed
HBASE-22634 Improve performance of BufferedMutator
Corrected unit test when neither hbase.htable.threads.max nor hbase.client.max.total.tasks are set
1 parent e73a9ec commit 737bd2d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/client/BufferedMutatorImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,11 @@ public class BufferedMutatorImpl implements BufferedMutator {
115115
cleanupPoolOnClose = false;
116116
}
117117
maxThreads = conf.getInt("hbase.htable.threads.max", Integer.MAX_VALUE);
118-
if (maxThreads <= 0) {
118+
if (maxThreads <= 0 || maxThreads == Integer.MAX_VALUE) {
119119
maxThreads = conf.getInt("hbase.client.max.total.tasks", Integer.MAX_VALUE);
120+
if (maxThreads <= 0 || maxThreads == Integer.MAX_VALUE) {
121+
maxThreads = 1;
122+
}
120123
}
121124
asfList = new ArrayList<AsyncRequestFuture>(maxThreads*4);
122125
ConnectionConfiguration tableConf = new ConnectionConfiguration(conf);

hbase-client/src/main/java/org/apache/hadoop/hbase/client/BufferedMutatorThreadPoolExecutor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ public BufferedMutatorThreadPoolExecutor(final int corePoolSize, final int maxim
6262

6363
public static BufferedMutatorThreadPoolExecutor getPoolExecutor(Configuration conf) {
6464
int maxThreads = conf.getInt("hbase.htable.threads.max", Integer.MAX_VALUE);
65-
if (maxThreads == 0) {
65+
if (maxThreads <= 0 || maxThreads == Integer.MAX_VALUE) {
6666
maxThreads = conf.getInt("hbase.client.max.total.tasks", Integer.MAX_VALUE);
6767
}
68-
if (maxThreads == 0) {
68+
if (maxThreads <= 0 || maxThreads == Integer.MAX_VALUE) {
6969
throw new IllegalArgumentException("hbase.client.max.total.tasks must be >0");
7070
}
7171
long keepAliveTime = conf.getLong("hbase.htable.threads.keepalivetime", 60);

0 commit comments

Comments
 (0)