ddanielr commented on code in PR #4741:
URL: https://github.com/apache/accumulo/pull/4741#discussion_r1688672896
##########
core/src/main/java/org/apache/accumulo/core/gc/ReferenceFile.java:
##########
@@ -30,6 +31,7 @@ public class ReferenceFile implements Reference,
Comparable<ReferenceFile> {
// parts of an absolute URI, like "hdfs://1.2.3.4/accumulo/tables/2a/t-0003"
public final TableId tableId; // 2a
public final boolean isScan;
+ public boolean isDirectory = false;
Review Comment:
ReferenceFile types shouldn't change so this boolean should be final
```suggestion
public final boolean isDirectory;
```
This could be supported by adding another boolean to the protected
constructor's method signature.
```
protected ReferenceFile(TableId tableId, String metadataEntry, boolean
isScan, boolean isDirectory) {
this.tableId = Objects.requireNonNull(tableId);
this.metadataEntry = Objects.requireNonNull(metadataEntry);
this.isScan = isScan;
this.isDirectory = isDirectory
}
```
And modifying the `forDirectory` constructor
```
public static ReferenceFile forDirectory(TableId tableId, String dirName) {
MetadataSchema.TabletsSection.ServerColumnFamily.validateDirCol(dirName);
return new ReferenceFile(tableId, dirName, false, true);
}
```
##########
server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectionAlgorithm.java:
##########
@@ -153,10 +153,10 @@ private void
removeCandidatesInUse(GarbageCollectionEnvironment gce,
tableIdsSeen.add(ref.getTableId());
if (ref.isDirectory()) {
- var dirReference = (ReferenceDirectory) ref;
- ServerColumnFamily.validateDirCol(dirReference.getTabletDir());
+ var dirReference = (ReferenceFile) ref;
+ ServerColumnFamily.validateDirCol(dirReference.getMetadataEntry());
- String dir = "/" + dirReference.tableId + "/" +
dirReference.getTabletDir();
+ String dir = "/" + dirReference.tableId + "/" +
dirReference.getMetadataEntry();
Review Comment:
The `dirReference` var was only created because `getTabletDir()` needed to
be called.
Since all references now use the Reference interface, the recast variable
can be removed
```
ServerColumnFamily.validateDirCol(ref.getMetadataEntry());
String dir = "/" + ref.tableId + "/" + ref.getMetadataEntry();
```
--
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]