Bug: CreateTableProcedure fails when FileBasedStoreFileTracker is set in global config
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 04/Oct/21 14:27

CreateTableProcedure tries to instantiate SFT impl in its preCreate method so that the given SFT impl can update the tbl descriptor with all its required configs. When global config is set to FILE, FileBasedStoreFileTracker currently needs store dir path at its construction time (via the passed StoreContext param), but we don't have this info at this stage, so FileBasedStoreFileTracker get's an NPE:

{noformat}
2021-10-01 14:28:21,310 ERROR org.apache.hadoop.hbase.procedure2.ProcedureExecutor: CODE-BUG: Uncaught runtime exception: pid=54, state=RUNNABLE:CREATE_TABLE_PRE_OPERATION, locked=true; CreateTableProcedure table=test-3
java.lang.UnsupportedOperationException: Constructor threw an exception for org.apache.hadoop.hbase.regionserver.storefiletracker.MigrationStoreFileTracker
        at org.apache.hadoop.hbase.util.ReflectionUtils.instantiate(ReflectionUtils.java:66)
        at org.apache.hadoop.hbase.util.ReflectionUtils.newInstance(ReflectionUtils.java:72)
        at org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory.create(StoreFileTrackerFactory.java:107)
        at org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory.persistTrackerConfig(StoreFileTrackerFactory.java:164)
        at org.apache.hadoop.hbase.master.procedure.CreateTableProcedure.preCreate(CreateTableProcedure.java:274)
        at org.apache.hadoop.hbase.master.procedure.CreateTableProcedure.executeFromState(CreateTableProcedure.java:102)
        at org.apache.hadoop.hbase.master.procedure.CreateTableProcedure.executeFromState(CreateTableProcedure.java:58)
        at org.apache.hadoop.hbase.procedure2.StateMachineProcedure.execute(StateMachineProcedure.java:194)
        at org.apache.hadoop.hbase.procedure2.Procedure.doExecute(Procedure.java:962)
        at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.execProcedure(ProcedureExecutor.java:1662)
        at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.executeProcedure(ProcedureExecutor.java:1409)
        at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.access$1100(ProcedureExecutor.java:78)
        at org.apache.hadoop.hbase.procedure2.ProcedureExecutor$WorkerThread.run(ProcedureExecutor.java:1979)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.apache.hadoop.hbase.util.ReflectionUtils.instantiate(ReflectionUtils.java:58)
        ... 12 more
Caused by: java.lang.UnsupportedOperationException: Constructor threw an exception for org.apache.hadoop.hbase.regionserver.storefiletracker.FileBasedStoreFileTracker
        at org.apache.hadoop.hbase.util.ReflectionUtils.instantiate(ReflectionUtils.java:66)
        at org.apache.hadoop.hbase.util.ReflectionUtils.newInstance(ReflectionUtils.java:72)
        at org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory.createForMigration(StoreFileTrackerFactory.java:157)
        at org.apache.hadoop.hbase.regionserver.storefiletracker.MigrationStoreFileTracker.<init>(MigrationStoreFileTracker.java:50)
        ... 17 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.apache.hadoop.hbase.util.ReflectionUtils.instantiate(ReflectionUtils.java:58)
        ... 20 more
Caused by: java.lang.NullPointerException
        at org.apache.hadoop.fs.Path.<init>(Path.java:146)
        at org.apache.hadoop.fs.Path.<init>(Path.java:125)
        at org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileListFile.<init>(StoreFileListFile.java:70)
        at org.apache.hadoop.hbase.regionserver.storefiletracker.FileBasedStoreFileTracker.<init>(FileBasedStoreFileTracker.java:59)
        ... 25 more
{noformat}