@@ -695,6 +695,7 @@ void sawNoSuchFamily() {
695695 private RegionCoprocessorHost coprocessorHost ;
696696
697697 private TableDescriptor htableDescriptor = null ;
698+ private ThreadPoolExecutor storeFileOpenAndCloseThreadPool ;
698699 private RegionSplitPolicy splitPolicy ;
699700 private FlushPolicy flushPolicy ;
700701
@@ -799,6 +800,8 @@ public HRegion(final HRegionFileSystem fs, final WAL wal, final Configuration co
799800 }
800801 }
801802 }
803+ storeFileOpenAndCloseThreadPool = newStoreFileOpenAndCloseThreadPool (
804+ "StoreFileOpenAndClose-" + getRegionInfo ().getEncodedName ());
802805
803806 this .rsServices = rsServices ;
804807 if (this .rsServices != null ) {
@@ -1769,7 +1772,7 @@ public Pair<byte[], Collection<HStoreFile>> call() throws IOException {
17691772 storeCloserThreadPool .shutdownNow ();
17701773 }
17711774 }
1772-
1775+ storeFileOpenAndCloseThreadPool . shutdownNow ();
17731776 status .setStatus ("Writing region close event to WAL" );
17741777 // Always write close marker to wal even for read only table. This is not a big problem as we
17751778 // do not write any data into the region; it is just a meta edit in the WAL file.
@@ -1888,13 +1891,16 @@ protected ThreadPoolExecutor getStoreOpenAndCloseThreadPool(
18881891 return getOpenAndCloseThreadPool (maxThreads , threadNamePrefix );
18891892 }
18901893
1891- protected ThreadPoolExecutor getStoreFileOpenAndCloseThreadPool (
1894+ public ThreadPoolExecutor getStoreFileOpenAndCloseThreadPool () {
1895+ return storeFileOpenAndCloseThreadPool ;
1896+ }
1897+
1898+ protected ThreadPoolExecutor newStoreFileOpenAndCloseThreadPool (
18921899 final String threadNamePrefix ) {
18931900 int numStores = Math .max (1 , this .htableDescriptor .getColumnFamilyCount ());
1894- int maxThreads = Math .max (1 ,
1901+ int maxThreads = Math .max (numStores ,
18951902 conf .getInt (HConstants .HSTORE_OPEN_AND_CLOSE_THREADS_MAX ,
1896- HConstants .DEFAULT_HSTORE_OPEN_AND_CLOSE_THREADS_MAX )
1897- / numStores );
1903+ HConstants .DEFAULT_HSTORE_OPEN_AND_CLOSE_THREADS_MAX ));
18981904 return getOpenAndCloseThreadPool (maxThreads , threadNamePrefix );
18991905 }
19001906
0 commit comments