This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new b5b48c3e38 adds range to compactable file (#3883)
b5b48c3e38 is described below
commit b5b48c3e389186e1229be7b8e5ab9e30d87dd52d
Author: Keith Turner <[email protected]>
AuthorDate: Tue Oct 24 20:50:52 2023 -0400
adds range to compactable file (#3883)
Now that tablet files have an associated range, this information should
be made available to compaction plugins. Making this information
available to plugins enable uses cases like selecting files with ranges
for compaction. This commit makes that information avialable by adding a
getRange method to CompactableFile
---
.../core/client/admin/compaction/CompactableFile.java | 19 +++++++++++++++++++
.../accumulo/core/metadata/CompactableFileImpl.java | 11 +++++++++++
2 files changed, 30 insertions(+)
diff --git
a/core/src/main/java/org/apache/accumulo/core/client/admin/compaction/CompactableFile.java
b/core/src/main/java/org/apache/accumulo/core/client/admin/compaction/CompactableFile.java
index baf5f04949..36b2d7b0ea 100644
---
a/core/src/main/java/org/apache/accumulo/core/client/admin/compaction/CompactableFile.java
+++
b/core/src/main/java/org/apache/accumulo/core/client/admin/compaction/CompactableFile.java
@@ -20,6 +20,7 @@ package org.apache.accumulo.core.client.admin.compaction;
import java.net.URI;
+import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.metadata.CompactableFileImpl;
/**
@@ -33,6 +34,16 @@ public interface CompactableFile {
public URI getUri();
+ /**
+ * @return A range associated with the file. If a file has an associated
range then Accumulo will
+ * limit reads to within the range. Not all files have an associated
range, it a file does
+ * not have a range then an infinite range is returned. The URI plus
this range uniquely
+ * identify a file.
+ *
+ * @since 3.1.0
+ */
+ public Range getRange();
+
public long getEstimatedSize();
public long getEstimatedEntries();
@@ -41,4 +52,12 @@ public interface CompactableFile {
return new CompactableFileImpl(uri, estimatedSize, estimatedEntries);
}
+ /**
+ * Creates a new CompactableFile object that implements this interface.
+ *
+ * @since 3.1.0
+ */
+ static CompactableFile create(URI uri, Range range, long estimatedSize, long
estimatedEntries) {
+ return new CompactableFileImpl(uri, range, estimatedSize,
estimatedEntries);
+ }
}
diff --git
a/core/src/main/java/org/apache/accumulo/core/metadata/CompactableFileImpl.java
b/core/src/main/java/org/apache/accumulo/core/metadata/CompactableFileImpl.java
index e3ff1a334a..b25e83dde3 100644
---
a/core/src/main/java/org/apache/accumulo/core/metadata/CompactableFileImpl.java
+++
b/core/src/main/java/org/apache/accumulo/core/metadata/CompactableFileImpl.java
@@ -22,6 +22,7 @@ import java.net.URI;
import java.util.Objects;
import org.apache.accumulo.core.client.admin.compaction.CompactableFile;
+import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.metadata.schema.DataFileValue;
public class CompactableFileImpl implements CompactableFile {
@@ -34,6 +35,11 @@ public class CompactableFileImpl implements CompactableFile {
this.dataFileValue = new DataFileValue(size, entries);
}
+ public CompactableFileImpl(URI uri, Range range, long size, long entries) {
+ this.storedTabletFile = StoredTabletFile.of(uri, range);
+ this.dataFileValue = new DataFileValue(size, entries);
+ }
+
public CompactableFileImpl(StoredTabletFile storedTabletFile, DataFileValue
dataFileValue) {
this.storedTabletFile = Objects.requireNonNull(storedTabletFile);
this.dataFileValue = Objects.requireNonNull(dataFileValue);
@@ -44,6 +50,11 @@ public class CompactableFileImpl implements CompactableFile {
return storedTabletFile.getPath().toUri();
}
+ @Override
+ public Range getRange() {
+ return storedTabletFile.getRange();
+ }
+
@Override
public String getFileName() {
return storedTabletFile.getFileName();