milleruntime commented on code in PR #2750:
URL: https://github.com/apache/accumulo/pull/2750#discussion_r892254084


##########
core/src/main/java/org/apache/accumulo/core/metadata/Reference.java:
##########
@@ -38,4 +38,28 @@ public Reference(TableId tableId, String metadataEntry) {
     this.metadataEntry = metadataEntry;
     this.tabletDir = metadataEntry;
   }
+
+  @Override
+  public int compareTo(Reference that) {
+    if (equals(that)) {
+      return 0;
+    } else {
+      return this.metadataEntry.compareTo(that.metadataEntry);
+    }
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj instanceof Reference) {
+      Reference that = (Reference) obj;
+      return this.metadataEntry.equals(that.metadataEntry);
+    } else {
+      return false;
+    }
+  }

Review Comment:
   So that is for the typical tablet file references, which I created 
`TabletFile` to represent which look like 
`hdfs://1.2.3.4/accumulo/tables/2a/t-0003/C0004.rf`. The GC is a different 
story entirely. The GC uses Strings to represent relative paths (for file and 
directories) as an optimization. I created the `Reference` class as a 
replacement for these Strings in the GC.
   
   For example, the GC will create relative paths to pass around like:
   
https://github.com/apache/accumulo/blob/76aaba0ec4e086ab535a1e88ba6ecb0f62481b2c/server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java#L319-L321
   
   And directories like:
   
https://github.com/apache/accumulo/blob/76aaba0ec4e086ab535a1e88ba6ecb0f62481b2c/server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java#L374-L379



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