ddanielr commented on code in PR #4691:
URL: https://github.com/apache/accumulo/pull/4691#discussion_r1681302899


##########
server/base/src/main/java/org/apache/accumulo/server/init/FileSystemInitializer.java:
##########
@@ -62,81 +60,109 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-class FileSystemInitializer {
+public class FileSystemInitializer {
   private static final String TABLE_TABLETS_TABLET_DIR = "table_info";
   private static final Logger log = 
LoggerFactory.getLogger(FileSystemInitializer.class);
+  private static final Text SPLIT_POINT =
+      MetadataSchema.TabletsSection.getRange().getEndKey().getRow();
 
   // config only for root table
   private final InitialConfiguration initConfig;
 
-  FileSystemInitializer(InitialConfiguration initConfig, ZooReaderWriter zoo, 
InstanceId uuid) {
+  public FileSystemInitializer(InitialConfiguration initConfig) {
     this.initConfig = initConfig;
   }
 
-  private static class Tablet {
+  public static class InitialTablet {
     TableId tableId;
     String dirName;
-    Text prevEndRow, endRow;
+    Text prevEndRow, endRow, extent;
     String[] files;
 
-    Tablet(TableId tableId, String dirName, Text prevEndRow, Text endRow, 
String... files) {
+    InitialTablet(TableId tableId, String dirName, Text prevEndRow, Text 
endRow, String... files) {
       this.tableId = tableId;
       this.dirName = dirName;
       this.prevEndRow = prevEndRow;
       this.endRow = endRow;
       this.files = files;
+      this.extent = new 
Text(MetadataSchema.TabletsSection.encodeRow(this.tableId, this.endRow));
     }
+
+    private TreeMap<Key,Value> createEntries() {
+      TreeMap<Key,Value> sorted = new TreeMap<>();
+      Value EMPTY_SIZE = new DataFileValue(0, 0).encodeAsValue();
+      sorted.put(new Key(this.extent, DIRECTORY_COLUMN.getColumnFamily(),
+          DIRECTORY_COLUMN.getColumnQualifier(), 0), new Value(this.dirName));
+      sorted.put(
+          new Key(this.extent, TIME_COLUMN.getColumnFamily(), 
TIME_COLUMN.getColumnQualifier(), 0),
+          new Value(new MetadataTime(0, TimeType.LOGICAL).encode()));
+      sorted.put(
+          new Key(this.extent, PREV_ROW_COLUMN.getColumnFamily(),
+              PREV_ROW_COLUMN.getColumnQualifier(), 0),
+          
MetadataSchema.TabletsSection.TabletColumnFamily.encodePrevEndRow(this.prevEndRow));
+      for (String file : this.files) {
+        var col =
+            new 
ColumnFQ(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME, new 
Text(file));
+        sorted.put(new Key(extent, col.getColumnFamily(), 
col.getColumnQualifier()), EMPTY_SIZE);
+      }
+      return sorted;

Review Comment:
   Yeah tablet metadata builder only exists in elasticity. 
   I started doing some preliminary work to see if I could backport it, but I 
don't think it should hold up this PR. 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to