@@ -616,6 +616,7 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
616616 final HRegionFileSystem regionFs ) throws IOException {
617617 final MasterFileSystem mfs = env .getMasterServices ().getMasterFileSystem ();
618618 final Configuration conf = env .getMasterConfiguration ();
619+ TableDescriptor htd = env .getMasterServices ().getTableDescriptors ().get (getTableName ());
619620 // The following code sets up a thread pool executor with as many slots as
620621 // there's files to split. It then fires up everything, waits for
621622 // completion and finally checks for any exception
@@ -625,12 +626,15 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
625626 // clean this up.
626627 int nbFiles = 0 ;
627628 final Map <String , Collection <StoreFileInfo >> files =
628- new HashMap <String , Collection <StoreFileInfo >>(regionFs .getFamilies ().size ());
629- for (String family : regionFs .getFamilies ()) {
629+ new HashMap <String , Collection <StoreFileInfo >>(htd .getColumnFamilyCount ());
630+ for (ColumnFamilyDescriptor cfd : htd .getColumnFamilies ()) {
631+ String family = cfd .getNameAsString ();
630632 Collection <StoreFileInfo > sfis = regionFs .getStoreFiles (family );
631- if (sfis == null ) continue ;
633+ if (sfis == null ) {
634+ continue ;
635+ }
632636 Collection <StoreFileInfo > filteredSfis = null ;
633- for (StoreFileInfo sfi : sfis ) {
637+ for (StoreFileInfo sfi : sfis ) {
634638 // Filter. There is a lag cleaning up compacted reference files. They get cleared
635639 // after a delay in case outstanding Scanners still have references. Because of this,
636640 // the listing of the Store content may have straggler reference files. Skip these.
@@ -651,20 +655,19 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
651655 }
652656 if (nbFiles == 0 ) {
653657 // no file needs to be splitted.
654- return new Pair <Integer , Integer >(0 ,0 );
658+ return new Pair <Integer , Integer >(0 , 0 );
655659 }
656660 // Max #threads is the smaller of the number of storefiles or the default max determined above.
657661 int maxThreads = Math .min (
658662 conf .getInt (HConstants .REGION_SPLIT_THREADS_MAX ,
659663 conf .getInt (HStore .BLOCKING_STOREFILES_KEY , HStore .DEFAULT_BLOCKING_STOREFILE_COUNT )),
660664 nbFiles );
661665 LOG .info ("pid=" + getProcId () + " splitting " + nbFiles + " storefiles, region=" +
662- getParentRegion ().getShortNameToLog () + ", threads=" + maxThreads );
663- final ExecutorService threadPool = Executors .newFixedThreadPool (
664- maxThreads , Threads .getNamedThreadFactory ("StoreFileSplitter-%1$d" ));
665- final List <Future <Pair <Path ,Path >>> futures = new ArrayList <Future <Pair <Path ,Path >>>(nbFiles );
666+ getParentRegion ().getShortNameToLog () + ", threads=" + maxThreads );
667+ final ExecutorService threadPool = Executors .newFixedThreadPool (maxThreads ,
668+ Threads .getNamedThreadFactory ("StoreFileSplitter-%1$d" ));
669+ final List <Future <Pair <Path , Path >>> futures = new ArrayList <Future <Pair <Path , Path >>>(nbFiles );
666670
667- TableDescriptor htd = env .getMasterServices ().getTableDescriptors ().get (getTableName ());
668671 // Split each store file.
669672 for (Map .Entry <String , Collection <StoreFileInfo >> e : files .entrySet ()) {
670673 byte [] familyName = Bytes .toBytes (e .getKey ());
@@ -674,9 +677,9 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
674677 for (StoreFileInfo storeFileInfo : storeFiles ) {
675678 // As this procedure is running on master, use CacheConfig.DISABLED means
676679 // don't cache any block.
677- StoreFileSplitter sfs = new StoreFileSplitter ( regionFs , familyName ,
678- new HStoreFile ( mfs . getFileSystem (), storeFileInfo , conf , CacheConfig . DISABLED ,
679- hcd .getBloomFilterType (), true ));
680+ StoreFileSplitter sfs =
681+ new StoreFileSplitter ( regionFs , familyName , new HStoreFile ( mfs . getFileSystem () ,
682+ storeFileInfo , conf , CacheConfig . DISABLED , hcd .getBloomFilterType (), true ));
680683 futures .add (threadPool .submit (sfs ));
681684 }
682685 }
@@ -688,7 +691,7 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
688691 // When splits ran on the RegionServer, how-long-to-wait-configuration was named
689692 // hbase.regionserver.fileSplitTimeout. If set, use its value.
690693 long fileSplitTimeout = conf .getLong ("hbase.master.fileSplitTimeout" ,
691- conf .getLong ("hbase.regionserver.fileSplitTimeout" , 600000 ));
694+ conf .getLong ("hbase.regionserver.fileSplitTimeout" , 600000 ));
692695 try {
693696 boolean stillRunning = !threadPool .awaitTermination (fileSplitTimeout , TimeUnit .MILLISECONDS );
694697 if (stillRunning ) {
@@ -697,11 +700,11 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
697700 while (!threadPool .isTerminated ()) {
698701 Thread .sleep (50 );
699702 }
700- throw new IOException ("Took too long to split the" +
701- " files and create the references, aborting split" );
703+ throw new IOException (
704+ "Took too long to split the" + " files and create the references, aborting split" );
702705 }
703706 } catch (InterruptedException e ) {
704- throw (InterruptedIOException )new InterruptedIOException ().initCause (e );
707+ throw (InterruptedIOException ) new InterruptedIOException ().initCause (e );
705708 }
706709
707710 int daughterA = 0 ;
@@ -721,9 +724,8 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
721724
722725 if (LOG .isDebugEnabled ()) {
723726 LOG .debug ("pid=" + getProcId () + " split storefiles for region " +
724- getParentRegion ().getShortNameToLog () +
725- " Daughter A: " + daughterA + " storefiles, Daughter B: " +
726- daughterB + " storefiles." );
727+ getParentRegion ().getShortNameToLog () + " Daughter A: " + daughterA +
728+ " storefiles, Daughter B: " + daughterB + " storefiles." );
727729 }
728730 return new Pair <Integer , Integer >(daughterA , daughterB );
729731 }
0 commit comments