Buggy code:
@ InterfaceAudience . Private public class RegionStates { private static final Log LOG = LogFactory . getLog ( RegionStates . class ) ; final HashMap < String , RegionState > regionsInTransition ; private final HashMap < String , RegionState > regionStates ; private final Map < ServerName , Set < HRegionInfo > > serverHoldings ; private final TreeMap < HRegionInfo , ServerName > regionAssignments ; private final HashMap < String , ServerName > lastAssignments ; private final HashMap < String , Long > deadServers ; private final HashMap < ServerName , Long > processedServers ; private long lastProcessedServerCleanTime ; private final RegionStateStore regionStateStore ; private final ServerManager serverManager ; private final Server server ; static final String LOG_SPLIT_TIME = "hbase.master.maximum.logsplit.keeptime" ; static final long DEFAULT_LOG_SPLIT_TIME = 7200000L ; RegionStates ( final Server master , final ServerManager serverManager , final RegionStateStore regionStateStore ) { } public synchronized Map < HRegionInfo , ServerName > getRegionAssignments ( ) { } public synchronized ServerName getRegionServerOfRegion ( HRegionInfo hri ) { } @ SuppressWarnings ( "unchecked" ) public synchronized Map < String , RegionState > getRegionsInTransition ( ) { } public synchronized boolean isRegionInTransition ( final HRegionInfo hri ) { } public synchronized boolean isRegionInTransition ( final String encodedName ) { } public synchronized boolean isRegionsInTransition ( ) { } public synchronized boolean isRegionOnline ( final HRegionInfo hri ) { } public synchronized boolean isRegionOffline ( final HRegionInfo hri ) { } public boolean isRegionInState ( final HRegionInfo hri , final State ... states ) { } public boolean isRegionInState ( final String encodedName , final State ... states ) { } public synchronized void waitForUpdate ( final long timeout ) throws InterruptedException { } public RegionState getRegionTransitionState ( final HRegionInfo hri ) { } public synchronized RegionState getRegionTransitionState ( final String encodedName ) { } public void createRegionStates ( final List < HRegionInfo > hris ) { } public RegionState createRegionState ( final HRegionInfo hri ) { } public synchronized RegionState createRegionState ( final HRegionInfo hri , State newState , ServerName serverName ) { } public RegionState updateRegionState ( final HRegionInfo hri , final State state ) { } public RegionState updateRegionState ( final RegionTransition transition , final State state ) { } public synchronized RegionState transitionOpenFromPendingOpenOrOpeningOnServer ( final RegionTransition transition , final RegionState fromState , final ServerName sn ) { } public RegionState updateRegionState ( final HRegionInfo hri , final State state , final ServerName serverName ) { } public void regionOnline ( final HRegionInfo hri , final ServerName serverName ) { } public void regionOnline ( final HRegionInfo hri , final ServerName serverName , long openSeqNum ) { } public synchronized void logSplit ( final ServerName serverName ) { } public void logSplit ( final HRegionInfo region ) { } public synchronized void clearLastAssignment ( final HRegionInfo region ) { } public void regionOffline ( final HRegionInfo hri ) { } public void regionOffline ( final HRegionInfo hri , final State expectedState ) { } public List < HRegionInfo > serverOffline ( final ZooKeeperWatcher watcher , final ServerName sn ) { } private void cleanIfNoMetaEntry ( Set < HRegionInfo > hris ) { if ( hris . isEmpty ( ) ) return ; for ( HRegionInfo hri : hris ) { try { <START_BUG> if ( ( MetaTableAccessor . getRegion ( server . getConnection ( ) , hri . getEncodedNameAsBytes ( ) ) ) == null ) { <END_BUG> regionOffline ( hri ) ; FSUtils . deleteRegionDir ( server . getConfiguration ( ) , hri ) ; } } catch ( IOException e ) { RegionStates . LOG . warn ( ( ( "Got<seq2seq4repair_space>exception<seq2seq4repair_space>while<seq2seq4repair_space>deleting<seq2seq4repair_space>" + hri ) + "<seq2seq4repair_space>directories<seq2seq4repair_space>from<seq2seq4repair_space>file<seq2seq4repair_space>system." ) , e ) ; } } } public synchronized List < HRegionInfo > getRegionsOfTable ( TableName tableName ) { } public synchronized void waitOnRegionToClearRegionsInTransition ( final HRegionInfo hri ) throws InterruptedException { } public void tableDeleted ( final TableName tableName ) { } synchronized boolean wasRegionOnDeadServer ( final String encodedName ) { } synchronized boolean isServerDeadAndNotProcessed ( ServerName server ) { } synchronized ServerName getLastRegionServerOfRegion ( final String encodedName ) { } synchronized void setLastRegionServerOfRegions ( final ServerName serverName , final List < HRegionInfo > regionInfos ) { } synchronized void setLastRegionServerOfRegion ( final ServerName serverName , final String encodedName ) { } synchronized void closeAllUserRegions ( Set < TableName > excludedTables ) { } protected synchronized double getAverageLoad ( ) { } protected Map < TableName , Map < ServerName , List < HRegionInfo > > > getAssignmentsByTable ( ) { } protected RegionState getRegionState ( final HRegionInfo hri ) { } protected synchronized RegionState getRegionState ( final String encodedName ) { } protected HRegionInfo getRegionInfo ( final byte [ ] regionName ) { } static boolean isOneOfStates ( RegionState regionState , State ... states ) { } private RegionState updateRegionState ( final HRegionInfo hri , final State state , final ServerName serverName , long openSeqNum ) { } private synchronized void deleteRegion ( final HRegionInfo hri ) { } }

Fix:
if ( ( MetaReader . getRegion ( server . getCatalogTracker ( ) , hri . getEncodedNameAsBytes ( ) ) ) == null ) {