1515 * See the License for the specific language governing permissions and
1616 * limitations under the License.
1717 */
18-
1918package org .apache .hadoop .hbase .rsgroup ;
2019
2120import com .google .protobuf .ServiceException ;
3332import java .util .Set ;
3433import java .util .SortedSet ;
3534import java .util .TreeSet ;
36- import org .apache .hadoop .conf .Configuration ;
3735import org .apache .hadoop .hbase .Coprocessor ;
3836import org .apache .hadoop .hbase .DoNotRetryIOException ;
3937import org .apache .hadoop .hbase .ServerName ;
4543import org .apache .hadoop .hbase .client .Get ;
4644import org .apache .hadoop .hbase .client .Mutation ;
4745import org .apache .hadoop .hbase .client .Put ;
48- import org .apache .hadoop .hbase .client .RegionInfo ;
4946import org .apache .hadoop .hbase .client .Result ;
5047import org .apache .hadoop .hbase .client .ResultScanner ;
5148import org .apache .hadoop .hbase .client .Scan ;
5956import org .apache .hadoop .hbase .master .MasterServices ;
6057import org .apache .hadoop .hbase .master .ServerListener ;
6158import org .apache .hadoop .hbase .master .TableStateManager ;
62- import org .apache .hadoop .hbase .master .assignment .RegionStateNode ;
6359import org .apache .hadoop .hbase .master .procedure .CreateTableProcedure ;
6460import org .apache .hadoop .hbase .master .procedure .MasterProcedureUtil ;
6561import org .apache .hadoop .hbase .net .Address ;
@@ -136,7 +132,6 @@ final class RSGroupInfoManagerImpl implements RSGroupInfoManager {
136132 private Set <String > prevRSGroups = new HashSet <>();
137133 private final ServerEventsListenerThread serverEventsListenerThread =
138134 new ServerEventsListenerThread ();
139- private FailedOpenUpdaterThread failedOpenUpdaterThread ;
140135
141136 private RSGroupInfoManagerImpl (MasterServices masterServices ) throws IOException {
142137 this .masterServices = masterServices ;
@@ -150,9 +145,6 @@ private synchronized void init() throws IOException {
150145 refresh ();
151146 serverEventsListenerThread .start ();
152147 masterServices .getServerManager ().registerListener (serverEventsListenerThread );
153- failedOpenUpdaterThread = new FailedOpenUpdaterThread (masterServices .getConfiguration ());
154- failedOpenUpdaterThread .start ();
155- masterServices .getServerManager ().registerListener (failedOpenUpdaterThread );
156148 }
157149
158150 static RSGroupInfoManager getInstance (MasterServices master ) throws IOException {
@@ -625,26 +617,6 @@ private synchronized void updateDefaultServers(SortedSet<Address> servers) throw
625617 flushConfig (newGroupMap );
626618 }
627619
628- // Called by FailedOpenUpdaterThread
629- private void updateFailedAssignments () {
630- // Kick all regions in FAILED_OPEN state
631- List <RegionInfo > stuckAssignments = Lists .newArrayList ();
632- for (RegionStateNode state : masterServices .getAssignmentManager ().getRegionStates ()
633- .getRegionsInTransition ()) {
634- if (state .isStuck ()) {
635- stuckAssignments .add (state .getRegionInfo ());
636- }
637- }
638- for (RegionInfo region : stuckAssignments ) {
639- LOG .info ("Retrying assignment of " + region );
640- try {
641- masterServices .getAssignmentManager ().unassign (region );
642- } catch (IOException e ) {
643- LOG .warn ("Unable to reassign " + region , e );
644- }
645- }
646- }
647-
648620 /**
649621 * Calls {@link RSGroupInfoManagerImpl#updateDefaultServers(SortedSet)} to update list of known
650622 * servers. Notifications about server changes are received by registering {@link ServerListener}.
@@ -704,66 +676,6 @@ public void run() {
704676 }
705677 }
706678
707- private class FailedOpenUpdaterThread extends Thread implements ServerListener {
708- private final long waitInterval ;
709- private volatile boolean hasChanged = false ;
710-
711- public FailedOpenUpdaterThread (Configuration conf ) {
712- this .waitInterval = conf .getLong (REASSIGN_WAIT_INTERVAL_KEY , DEFAULT_REASSIGN_WAIT_INTERVAL );
713- setDaemon (true );
714- }
715-
716- @ Override
717- public void serverAdded (ServerName serverName ) {
718- serverChanged ();
719- }
720-
721- @ Override
722- public void serverRemoved (ServerName serverName ) {
723- }
724-
725- @ Override
726- public void run () {
727- while (isMasterRunning (masterServices )) {
728- boolean interrupted = false ;
729- try {
730- synchronized (this ) {
731- while (!hasChanged ) {
732- wait ();
733- }
734- hasChanged = false ;
735- }
736- } catch (InterruptedException e ) {
737- LOG .warn ("Interrupted" , e );
738- interrupted = true ;
739- }
740- if (!isMasterRunning (masterServices ) || interrupted ) {
741- continue ;
742- }
743-
744- // First, wait a while in case more servers are about to rejoin the cluster
745- try {
746- Thread .sleep (waitInterval );
747- } catch (InterruptedException e ) {
748- LOG .warn ("Interrupted" , e );
749- }
750- if (!isMasterRunning (masterServices )) {
751- continue ;
752- }
753-
754- // Kick all regions in FAILED_OPEN state
755- updateFailedAssignments ();
756- }
757- }
758-
759- public void serverChanged () {
760- synchronized (this ) {
761- hasChanged = true ;
762- this .notify ();
763- }
764- }
765- }
766-
767679 private class RSGroupStartupWorker extends Thread {
768680 private final Logger LOG = LoggerFactory .getLogger (RSGroupStartupWorker .class );
769681 private volatile boolean online = false ;
0 commit comments