keith-turner commented on code in PR #4682:
URL: https://github.com/apache/accumulo/pull/4682#discussion_r1644695609
##########
core/src/main/java/org/apache/accumulo/core/metadata/ScanServerRefTabletFile.java:
##########
@@ -22,38 +22,80 @@
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()));
Review Comment:
Could add some validation of the persisted data here.
```suggestion
var row = k.getRow().toString();
Preconditions.checkArgument(row.startsWith(prefix), "Unexpected row
prefix %s ", row);
uuid = new Text(row.substring(prefix.length()));
Preconditions.checkArgument(isUuid(uuid), "Row suffix is not uuid %s",
row);
```
##########
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader9to10.java:
##########
@@ -583,6 +591,18 @@ public void upgradeFileDeletes(ServerContext context,
Ample.DataLevel level) {
}
}
+ public void removeAllScanServerRefs(ServerContext context, Ample.DataLevel
level) {
Review Comment:
I think this upgrade code will only run if going from 2.0.x/1.10.x to 2.1.x.
Scan servers did not exist in 2.0.x/1.10.x, so this code may never do anything.
##########
core/src/main/java/org/apache/accumulo/core/metadata/ScanServerRefTabletFile.java:
##########
@@ -22,38 +22,80 @@
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();
Review Comment:
Could make this all caps since its a constant.
--
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]