@@ -626,6 +626,7 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
626626 final HRegionFileSystem regionFs ) throws IOException {
627627 final MasterFileSystem mfs = env .getMasterServices ().getMasterFileSystem ();
628628 final Configuration conf = env .getMasterConfiguration ();
629+ TableDescriptor htd = env .getMasterServices ().getTableDescriptors ().get (getTableName ());
629630 // The following code sets up a thread pool executor with as many slots as
630631 // there's files to split. It then fires up everything, waits for
631632 // completion and finally checks for any exception
@@ -635,12 +636,15 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
635636 // clean this up.
636637 int nbFiles = 0 ;
637638 final Map <String , Collection <StoreFileInfo >> files =
638- new HashMap <String , Collection <StoreFileInfo >>(regionFs .getFamilies ().size ());
639- for (String family : regionFs .getFamilies ()) {
639+ new HashMap <String , Collection <StoreFileInfo >>(htd .getColumnFamilyCount ());
640+ for (ColumnFamilyDescriptor cfd : htd .getColumnFamilies ()) {
641+ String family = cfd .getNameAsString ();
640642 Collection <StoreFileInfo > sfis = regionFs .getStoreFiles (family );
641- if (sfis == null ) continue ;
643+ if (sfis == null ) {
644+ continue ;
645+ }
642646 Collection <StoreFileInfo > filteredSfis = null ;
643- for (StoreFileInfo sfi : sfis ) {
647+ for (StoreFileInfo sfi : sfis ) {
644648 // Filter. There is a lag cleaning up compacted reference files. They get cleared
645649 // after a delay in case outstanding Scanners still have references. Because of this,
646650 // the listing of the Store content may have straggler reference files. Skip these.
@@ -661,20 +665,19 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
661665 }
662666 if (nbFiles == 0 ) {
663667 // no file needs to be splitted.
664- return new Pair <Integer , Integer >(0 ,0 );
668+ return new Pair <Integer , Integer >(0 , 0 );
665669 }
666670 // Max #threads is the smaller of the number of storefiles or the default max determined above.
667671 int maxThreads = Math .min (
668672 conf .getInt (HConstants .REGION_SPLIT_THREADS_MAX ,
669673 conf .getInt (HStore .BLOCKING_STOREFILES_KEY , HStore .DEFAULT_BLOCKING_STOREFILE_COUNT )),
670674 nbFiles );
671675 LOG .info ("pid=" + getProcId () + " splitting " + nbFiles + " storefiles, region=" +
672- getParentRegion ().getShortNameToLog () + ", threads=" + maxThreads );
673- final ExecutorService threadPool = Executors .newFixedThreadPool (
674- maxThreads , Threads .getNamedThreadFactory ("StoreFileSplitter-%1$d" ));
675- final List <Future <Pair <Path ,Path >>> futures = new ArrayList <Future <Pair <Path ,Path >>>(nbFiles );
676+ getParentRegion ().getShortNameToLog () + ", threads=" + maxThreads );
677+ final ExecutorService threadPool = Executors .newFixedThreadPool (maxThreads ,
678+ Threads .getNamedThreadFactory ("StoreFileSplitter-%1$d" ));
679+ final List <Future <Pair <Path , Path >>> futures = new ArrayList <Future <Pair <Path , Path >>>(nbFiles );
676680
677- TableDescriptor htd = env .getMasterServices ().getTableDescriptors ().get (getTableName ());
678681 // Split each store file.
679682 for (Map .Entry <String , Collection <StoreFileInfo >> e : files .entrySet ()) {
680683 byte [] familyName = Bytes .toBytes (e .getKey ());
@@ -689,9 +692,9 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
689692 for (StoreFileInfo storeFileInfo : storeFiles ) {
690693 // As this procedure is running on master, use CacheConfig.DISABLED means
691694 // don't cache any block.
692- StoreFileSplitter sfs = new StoreFileSplitter ( regionFs , familyName ,
693- new HStoreFile ( mfs . getFileSystem (), storeFileInfo , conf , CacheConfig . DISABLED ,
694- hcd .getBloomFilterType (), true ));
695+ StoreFileSplitter sfs =
696+ new StoreFileSplitter ( regionFs , familyName , new HStoreFile ( mfs . getFileSystem () ,
697+ storeFileInfo , conf , CacheConfig . DISABLED , hcd .getBloomFilterType (), true ));
695698 futures .add (threadPool .submit (sfs ));
696699 }
697700 }
@@ -703,7 +706,7 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
703706 // When splits ran on the RegionServer, how-long-to-wait-configuration was named
704707 // hbase.regionserver.fileSplitTimeout. If set, use its value.
705708 long fileSplitTimeout = conf .getLong ("hbase.master.fileSplitTimeout" ,
706- conf .getLong ("hbase.regionserver.fileSplitTimeout" , 600000 ));
709+ conf .getLong ("hbase.regionserver.fileSplitTimeout" , 600000 ));
707710 try {
708711 boolean stillRunning = !threadPool .awaitTermination (fileSplitTimeout , TimeUnit .MILLISECONDS );
709712 if (stillRunning ) {
@@ -712,11 +715,11 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
712715 while (!threadPool .isTerminated ()) {
713716 Thread .sleep (50 );
714717 }
715- throw new IOException ("Took too long to split the" +
716- " files and create the references, aborting split" );
718+ throw new IOException (
719+ "Took too long to split the" + " files and create the references, aborting split" );
717720 }
718721 } catch (InterruptedException e ) {
719- throw (InterruptedIOException )new InterruptedIOException ().initCause (e );
722+ throw (InterruptedIOException ) new InterruptedIOException ().initCause (e );
720723 }
721724
722725 int daughterA = 0 ;
@@ -736,9 +739,8 @@ private Pair<Integer, Integer> splitStoreFiles(final MasterProcedureEnv env,
736739
737740 if (LOG .isDebugEnabled ()) {
738741 LOG .debug ("pid=" + getProcId () + " split storefiles for region " +
739- getParentRegion ().getShortNameToLog () +
740- " Daughter A: " + daughterA + " storefiles, Daughter B: " +
741- daughterB + " storefiles." );
742+ getParentRegion ().getShortNameToLog () + " Daughter A: " + daughterA +
743+ " storefiles, Daughter B: " + daughterB + " storefiles." );
742744 }
743745 return new Pair <Integer , Integer >(daughterA , daughterB );
744746 }
0 commit comments