HBASE-6018 hbck fails with a RejectedExecutionException when >50 regions present
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1339876 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3949d1edb1
commit
f460eaadb8
|
@ -33,7 +33,7 @@ import java.util.SortedSet;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.concurrent.ConcurrentSkipListMap;
|
import java.util.concurrent.ConcurrentSkipListMap;
|
||||||
import java.util.concurrent.SynchronousQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
@ -222,9 +222,9 @@ public class HBaseFsck {
|
||||||
this.conf = conf;
|
this.conf = conf;
|
||||||
|
|
||||||
int numThreads = conf.getInt("hbasefsck.numthreads", MAX_NUM_THREADS);
|
int numThreads = conf.getInt("hbasefsck.numthreads", MAX_NUM_THREADS);
|
||||||
executor = new ThreadPoolExecutor(1, numThreads,
|
executor = new ThreadPoolExecutor(numThreads, numThreads,
|
||||||
THREADS_KEEP_ALIVE_SECONDS, TimeUnit.SECONDS,
|
THREADS_KEEP_ALIVE_SECONDS, TimeUnit.SECONDS,
|
||||||
new SynchronousQueue<Runnable>());
|
new LinkedBlockingQueue<Runnable>());
|
||||||
executor.allowCoreThreadTimeOut(true);
|
executor.allowCoreThreadTimeOut(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -360,6 +360,27 @@ public class TestHBaseFsck {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test thread pooling in the case where there are more regions than threads
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testHbckThreadpooling() throws Exception {
|
||||||
|
String table = "tableDupeStartKey";
|
||||||
|
try {
|
||||||
|
// Create table with 4 regions
|
||||||
|
setupTable(table);
|
||||||
|
|
||||||
|
// limit number of threads to 1.
|
||||||
|
Configuration newconf = new Configuration(conf);
|
||||||
|
newconf.setInt("hbasefsck.numthreads", 1);
|
||||||
|
assertNoErrors(doFsck(newconf, false));
|
||||||
|
|
||||||
|
// We should pass without triggering a RejectedExecutionException
|
||||||
|
} finally {
|
||||||
|
deleteTable(table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This create and fixes a bad table with regions that have a duplicate
|
* This create and fixes a bad table with regions that have a duplicate
|
||||||
* start key
|
* start key
|
||||||
|
|
Loading…
Reference in New Issue