[ https://issues.apache.org/jira/browse/HBASE-19937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16353537#comment-16353537 ]
Xiaolin Ha commented on HBASE-19937: ------------------------------------ When enable rsgroup, we should set config "hbase.master.loadbalancer.class" to "org.apache.hadoop.hbase.rsgroup.RSGroupBasedLoadBalancer". When master started, it will first load SystemCoprocessors by {code:java} 844 his.cpHost = new MasterCoprocessorHost(this, this.conf);{code} and then initialize load balancer by {code:java} 866 this.balancer.setMasterServices(this); 867 this.balancer.setClusterMetrics(getClusterMetricsWithoutCoprocessor()); 868 this.balancer.initialize(); {code} but because of HMaster using classes relevant of rsgroup just at the time of load SystemCoprocessors, the codes without fix create rsgroup system table at that time, too. All system tables created by using CreateTableProcedure.executeFromState, which will call getBalancer().roundRobinAssignment, getBalancer() returns LoadBalancerFactory.getLoadBalancer(conf), which we has set to be RSGroupBasedLoadBalancer. RSGroupBasedLoadBalancer called initialize() after create hbase:rsgroup table, so it will be throw NPE. > Enable rsgroup NPE in CreateTableProcedure > ------------------------------------------ > > Key: HBASE-19937 > URL: https://issues.apache.org/jira/browse/HBASE-19937 > Project: HBase > Issue Type: Bug > Components: rsgroup > Affects Versions: 2.0.0-beta-2 > Reporter: Xiaolin Ha > Assignee: Xiaolin Ha > Priority: Major > Attachments: HBASE-19937.branch-2.001.patch > > > When enable rsgroup, it may throws NPE as follows, > 2018-02-02,16:12:45,688 ERROR > org.apache.hadoop.hbase.procedure2.ProcedureExecutor: CODE-BUG: Uncaught > runtime exception: pid=7, state=RUNNABLE:CREATE_TABLE_ASSIGN_REGIONS; > CreateTableProcedure table=hbase:rsgroup > java.lang.NullPointerException > at > org.apache.hadoop.hbase.rsgroup.RSGroupBasedLoadBalancer.generateGroupMaps(RSGroupBasedLoadBalancer.java:254) > at > org.apache.hadoop.hbase.rsgroup.RSGroupBasedLoadBalancer.roundRobinAssignment(RSGroupBasedLoadBalancer.java:162) > at > org.apache.hadoop.hbase.master.assignment.AssignmentManager.createRoundRobinAssignProcedures(AssignmentManager.java:603) > at > org.apache.hadoop.hbase.master.procedure.CreateTableProcedure.executeFromState(CreateTableProcedure.java:108) > at > org.apache.hadoop.hbase.master.procedure.CreateTableProcedure.executeFromState(CreateTableProcedure.java:51) > at > org.apache.hadoop.hbase.procedure2.StateMachineProcedure.execute(StateMachineProcedure.java:182) > at org.apache.hadoop.hbase.procedure2.Procedure.doExecute(Procedure.java:845) > at > org.apache.hadoop.hbase.procedure2.ProcedureExecutor.execProcedure(ProcedureExecutor.java:1458) > at > org.apache.hadoop.hbase.procedure2.ProcedureExecutor.executeProcedure(ProcedureExecutor.java:1227) > at > org.apache.hadoop.hbase.procedure2.ProcedureExecutor.access$800(ProcedureExecutor.java:78) > at > org.apache.hadoop.hbase.procedure2.ProcedureExecutor$WorkerThread.run(ProcedureExecutor.java:1738) > > As a result of CreateTableProcedure.rollbackState, it may then print logs > warning TableExistsException as follows, > 2018-02-02,16:12:55,503 WARN > org.apache.hadoop.hbase.rsgroup.RSGroupInfoManagerImpl$RSGroupStartupWorker: > Failed to perform check > java.io.IOException: Failed to create group table. > org.apache.hadoop.hbase.TableExistsException: hbase:rsgroup > at > org.apache.hadoop.hbase.rsgroup.RSGroupInfoManagerImpl$RSGroupStartupWorker.createRSGroupTable(RSGroupInfoManagerImpl.java:877) > > After some auto-retries, it loops running the thread RSGroupStartupWorker, > will print logs as follows, > 2018-02-02,16:23:17,626 INFO > org.apache.hadoop.hbase.rsgroup.RSGroupInfoManagerImpl$RSGroupStartupWorker: > RSGroup table=hbase:rsgroup isOnline=true, regionCount=0, assignCount=0, > rootMetaFound=true > 2018-02-02,16:23:17,730 INFO > org.apache.hadoop.hbase.rsgroup.RSGroupInfoManagerImpl$RSGroupStartupWorker: > RSGroup table=hbase:rsgroup isOnline=true, regionCount=0, assignCount=0, > rootMetaFound=true > 2018-02-02,16:23:17,834 INFO > org.apache.hadoop.hbase.rsgroup.RSGroupInfoManagerImpl$RSGroupStartupWorker: > RSGroup table=hbase:rsgroup isOnline=true, regionCount=0, assignCount=0, > rootMetaFound=true > 2018-02-02,16:23:17,937 INFO > org.apache.hadoop.hbase.rsgroup.RSGroupInfoManagerImpl$RSGroupStartupWorker: > RSGroup table=hbase:rsgroup isOnline=true, regionCount=0, assignCount=0, > rootMetaFound=true > > And using shells of rsgroup, it will tips that currently is in "offline mode". > > The reason of this problem is that CreateTableProcedure used > RSGroupBasedLoadBalancer, who has member variables initialized depending on > return of CreateTableProcedure. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)