You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "cshannon (via GitHub)" <gi...@apache.org> on 2023/05/09 21:52:16 UTC

[GitHub] [accumulo] cshannon commented on a diff in pull request #3385: Encapsulate file metadata inside a new object

cshannon commented on code in PR #3385:
URL: https://github.com/apache/accumulo/pull/3385#discussion_r1189166856


##########
core/src/main/java/org/apache/accumulo/core/metadata/StoredTabletFile.java:
##########
@@ -33,39 +35,47 @@
  * in Upgrader9to10.upgradeRelativePaths()
  */
 public class StoredTabletFile extends TabletFile {
-  private final String metadataEntry;
+  private final TabletFileMetadataEntry metadataEntry;
+
+  /**
+   * Construct a tablet file using the {@link TabletFileMetadataEntry} from the metadata. Preserve
+   * the exact string so the entry can be deleted.
+   */
+  public StoredTabletFile(final TabletFileMetadataEntry metadataEntry) {
+    super(Objects.requireNonNull(metadataEntry).getFilePath());
+    this.metadataEntry = metadataEntry;
+  }
 
   /**
    * Construct a tablet file using the string read from the metadata. Preserve the exact string so
    * the entry can be deleted.
    */
-  public StoredTabletFile(String metadataEntry) {
-    super(new Path(metadataEntry));
-    this.metadataEntry = metadataEntry;
+  public StoredTabletFile(final String metadataEntry) {
+    this(TabletFileMetadataEntry.of(metadataEntry));
   }
 
   /**
-   * Return the exact string that is stored in the metadata table. This is important for updating
-   * and deleting metadata entries. If the exact string is not used, erroneous entries can pollute
-   * the metadata table.
+   * Return the {@link TabletFileMetadataEntry} which contains the exact string that is stored in
+   * the metadata table. This is important for updating and deleting metadata entries. If the exact
+   * string is not used, erroneous entries can pollute the metadata table.
    */
-  public String getMetaUpdateDelete() {
+  public TabletFileMetadataEntry getMetaUpdateDelete() {
     return metadataEntry;
   }
 
   /**
    * Return a new Text object of {@link #getMetaUpdateDelete()}
    */
   public Text getMetaUpdateDeleteText() {
-    return new Text(getMetaUpdateDelete());
+    return getMetaUpdateDelete().getMetaText();

Review Comment:
   There is no current difference but it seems like these methods for separate insertion and deletions were set up like this intentionally based on the comments and javadoc in case it was different in the future. I can refactor things and fix this but I wasn't quite sure the history as to why they could be different or if they will always just be the same.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org