keith-turner commented on code in PR #2767:
URL: https://github.com/apache/accumulo/pull/2767#discussion_r898034465
##########
core/src/main/java/org/apache/accumulo/core/gc/ReferenceDirectory.java:
##########
@@ -21,13 +21,22 @@
import org.apache.accumulo.core.data.TableId;
/**
- * Part of the Tablet File path that is definitely a directory.
+ * A GC reference to a Tablet directory, like t-0003.
*/
-public class ReferenceDirectory extends Reference {
- public final String tabletDir; // t-0003
+public class ReferenceDirectory extends ReferenceFile {
+ private final String tabletDir; // t-0003
public ReferenceDirectory(TableId tableId, String dirName) {
super(tableId, dirName);
Review Comment:
Would some validation make sense for this new class? Something like the
following as an example, but not sure its correct.
```suggestion
private static validateDirName(String dirName) {
checkArgument(dirName.matches("[0-9A-Za-z]+")));
}
public ReferenceDirectory(TableId tableId, String dirName) {
super(tableId, validateDirName(dirName));
```
##########
server/base/src/main/java/org/apache/accumulo/server/gc/GcVolumeUtil.java:
##########
@@ -24,20 +24,20 @@
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.data.TableId;
-import org.apache.accumulo.core.gc.Reference;
import
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ServerColumnFamily;
import org.apache.accumulo.server.fs.VolumeManager;
import org.apache.hadoop.fs.Path;
public class GcVolumeUtil {
// AGCAV : Accumulo Garbage Collector All Volumes
- private static final String ALL_VOLUMES_PREFIX = "agcav:/";
+ static final String ALL_VOLUMES_PREFIX = "agcav:/";
- public static Reference getDeleteTabletOnAllVolumesUri(TableId tableId,
String dirName) {
+ public static AllVolumesDirectory getDeleteTabletOnAllVolumesUri(TableId
tableId,
Review Comment:
Would it make sense to move this method to the new AllVolumesDirectory
class? I am not sure if that makes sense because I don't know enough about the
surrounding context.
##########
core/src/main/java/org/apache/accumulo/core/gc/ReferenceFile.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.gc;
+
+import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema;
+
+/**
+ * A GC reference used for streaming and delete markers. This type is a file.
Subclass is a
+ * directory.
+ */
+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
+
+ // the exact string that is stored in the metadata
+ public final String metadataEntry;
+
+ public ReferenceFile(TableId tableId, String metadataEntry) {
+
MetadataSchema.TabletsSection.ServerColumnFamily.validateDirCol(tableId.canonical());
+ this.tableId = tableId;
+ this.metadataEntry = metadataEntry;
+ }
+
+ @Override
+ public boolean isDirectory() {
+ return false;
+ }
+
+ @Override
+ public TableId getTableId() {
+ return tableId;
+ }
+
+ @Override
+ public String getMetadataEntry() {
+ return metadataEntry;
+ }
+
+ @Override
+ public int compareTo(ReferenceFile that) {
+ if (equals(that)) {
+ return 0;
+ } else {
+ return this.metadataEntry.compareTo(that.metadataEntry);
Review Comment:
Is this sort order important for the correctness of GC Algorithm?
--
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]