dlmarion commented on code in PR #4682:
URL: https://github.com/apache/accumulo/pull/4682#discussion_r1644619067


##########
core/src/main/java/org/apache/accumulo/core/metadata/ScanServerRefTabletFile.java:
##########
@@ -22,38 +22,85 @@
 import java.util.Objects;
 import java.util.UUID;
 
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
+import 
org.apache.accumulo.core.metadata.schema.MetadataSchema.OldScanServerFileReferenceSection;
+import 
org.apache.accumulo.core.metadata.schema.MetadataSchema.ScanServerFileReferenceSection;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
 
 public class ScanServerRefTabletFile extends TabletFile {
 
+  @SuppressWarnings("deprecation")
+  private static final String oldPrefix = 
OldScanServerFileReferenceSection.getRowPrefix();
+  private final String prefix;
   private final Value NULL_VALUE = new Value(new byte[0]);
-  private final Text colf;
-  private final Text colq;
+  private final Text serverAddress;
+  private final Text uuid;
 
-  public ScanServerRefTabletFile(String file, String serverAddress, UUID 
serverLockUUID) {
+  public ScanServerRefTabletFile(UUID serverLockUUID, String serverAddress, 
String file) {
     super(new Path(URI.create(file)));
-    this.colf = new Text(serverAddress);
-    this.colq = new Text(serverLockUUID.toString());
+    // For new data, always use the current prefix
+    prefix = ScanServerFileReferenceSection.getRowPrefix();
+    this.serverAddress = new Text(serverAddress);
+    uuid = new Text(serverLockUUID.toString());
   }
 
-  public ScanServerRefTabletFile(String file, Text colf, Text colq) {
-    super(new Path(URI.create(file)));
-    this.colf = colf;
-    this.colq = colq;
+  public ScanServerRefTabletFile(Key k) {
+    super(new Path(URI.create(extractFile(k))));
+    serverAddress = k.getColumnFamily();
+    if (isOldPrefix(k)) {
+      prefix = oldPrefix;
+      uuid = new Text(k.getColumnQualifier().toString());
+    } else {
+      prefix = ScanServerFileReferenceSection.getRowPrefix();
+      uuid = new Text(k.getRow().toString().substring(prefix.length()));
+    }
+  }
+
+  public Mutation putMutation() {
+    Mutation mutation;
+    if (Objects.equals(prefix, oldPrefix)) {

Review Comment:
   Do we still need to insert old style mutations?



##########
server/base/src/main/java/org/apache/accumulo/server/metadata/ServerAmpleImpl.java:
##########
@@ -377,14 +377,11 @@ public void deleteScanServerFileReferences(String 
serverAddress, UUID scanServer
     Objects.requireNonNull(scanServerLockUUID, "Server uuid must be supplied");
     try (
         Scanner scanner = context.createScanner(DataLevel.USER.metaTable(), 
Authorizations.EMPTY)) {
-      scanner.setRange(ScanServerFileReferenceSection.getRange());
-      scanner.fetchColumn(new Text(serverAddress), new 
Text(scanServerLockUUID.toString()));
+      scanner
+          .setRange(new Range(ScanServerFileReferenceSection.getRowPrefix() + 
scanServerLockUUID));

Review Comment:
   If we still need to insert old style mutations, do we still need to look for 
them here?



##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/MetadataSchema.java:
##########
@@ -488,6 +488,20 @@ public static String getRowPrefix() {
   }
 
   public static class ScanServerFileReferenceSection {
+    private static final Section section =
+        new Section(RESERVED_PREFIX + "scanr", true, RESERVED_PREFIX + 
"scans", false);

Review Comment:
   I wonder if the prefix should be `scanfileref` instead of `scanr`, if only 
so that someone looking at the metadata entries does not conflate the entry 
with `Scanner` somehow or the existing `scan` column family in the Tablet 
metadata.



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