saintstack commented on a change in pull request #1011: HBASE-23055 Alter 
hbase:meta
URL: https://github.com/apache/hbase/pull/1011#discussion_r366586004
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSTableDescriptors.java
 ##########
 @@ -135,16 +136,32 @@ public FSTableDescriptors(final Configuration conf, 
final FileSystem fs,
    *                     TODO: This is a workaround. Should remove this ugly 
code...
    */
   public FSTableDescriptors(final Configuration conf, final FileSystem fs,
-                            final Path rootdir, final boolean fsreadonly, 
final boolean usecache,
-                            Function<TableDescriptorBuilder, 
TableDescriptorBuilder> metaObserver) throws IOException {
+       final Path rootdir, final boolean fsreadonly, final boolean usecache,
+       Function<TableDescriptorBuilder, TableDescriptorBuilder> metaObserver) 
throws IOException {
     this.fs = fs;
     this.rootdir = rootdir;
     this.fsreadonly = fsreadonly;
     this.usecache = usecache;
-    this.metaTableDescriptor = metaObserver == null ? 
createMetaTableDescriptor(conf)
-          : metaObserver.apply(createMetaTableDescriptorBuilder(conf)).build();
+    TableDescriptor td = null;
+    try {
+      td = getTableDescriptorFromFs(fs, rootdir, TableName.META_TABLE_NAME);
+    } catch (TableInfoMissingException e) {
+      td = metaObserver == null? createMetaTableDescriptor(conf):
+        metaObserver.apply(createMetaTableDescriptorBuilder(conf)).build();
+      if (!fsreadonly) {
+        LOG.info("Creating new hbase:meta table default descriptor/schema {}", 
td);
+        updateTableDescriptor(td);
+      }
+    }
+    this.metaTableDescriptor = td;
   }
 
+  /**
+   *
+   * Should be private
+   * @deprecated Since 2.3.0. Should be for internal use only. Used by testing.
 
 Review comment:
   Leaving it public for now (after removing the deprecated).  Need to undo one 
reference in test before can take it private.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to