Skip to content
Permalink
Browse files
Resolve todo by removing unused MajorCompactionRequest.openReader met…
…hod (#2710)

Related to #2699
  • Loading branch information
dlmarion committed May 17, 2022
1 parent 250fdaa commit e52df66b944e3e15098fa3ff65ff9f05aad6afc2
Showing 2 changed files with 0 additions and 109 deletions.
@@ -18,7 +18,6 @@
*/
package org.apache.accumulo.tserver.compaction;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -38,8 +37,6 @@
import org.apache.accumulo.core.data.TabletId;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.accumulo.core.dataImpl.TabletIdImpl;
import org.apache.accumulo.core.file.FileOperations;
import org.apache.accumulo.core.file.FileSKVIterator;
import org.apache.accumulo.core.metadata.StoredTabletFile;
import org.apache.accumulo.core.metadata.TabletFile;
import org.apache.accumulo.core.metadata.schema.DataFileValue;
@@ -178,19 +175,6 @@ public void setFiles(Map<StoredTabletFile,DataFileValue> update) {
this.files = Collections.unmodifiableMap(update);
}

public FileSKVIterator openReader(TabletFile tabletFile) throws IOException {
Objects.requireNonNull(volumeManager,
"Opening files is not supported at this time. It's only supported when "
+ "CompactionStrategy.gatherInformation() is called.");
// @TODO verify the file isn't some random file in HDFS
// @TODO ensure these files are always closed?
FileOperations fileFactory = FileOperations.getInstance();
FileSystem ns = volumeManager.getFileSystemByPath(tabletFile.getPath());
return fileFactory.newReaderBuilder()
.forFile(tabletFile.getPathStr(), ns, ns.getConf(), context.getCryptoService())
.withTableConfiguration(tableConfig).seekToBeginning().build();
}

public Map<String,String> getTableProperties() {
return tableConfig.getAllPropertiesWithPrefix(Property.TABLE_PREFIX);
}
@@ -21,7 +21,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.DataInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -32,27 +31,18 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.ConfigurationCopy;
import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.crypto.CryptoServiceFactory;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.accumulo.core.file.FileSKVIterator;
import org.apache.accumulo.core.file.blockfile.impl.CacheProvider;
import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.metadata.StoredTabletFile;
import org.apache.accumulo.core.metadata.TabletFile;
import org.apache.accumulo.core.metadata.schema.DataFileValue;
import org.apache.accumulo.core.sample.impl.SamplerConfigurationImpl;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.server.ServerContext;
import org.apache.hadoop.io.Text;
@@ -89,95 +79,12 @@ public static ServerContext getServerContext() {
fakeFiles.put("file4", keys(null, null));
}

// Mock FileSKVIterator, which will provide first/last keys above
private static class TestFileSKVIterator implements FileSKVIterator {
private String filename;

TestFileSKVIterator(String filename) {
this.filename = filename;
}

@Override
public void setInterruptFlag(AtomicBoolean flag) {}

@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options,
IteratorEnvironment env) {}

@Override
public boolean hasTop() {
return false;
}

@Override
public void next() {}

@Override
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) {}

@Override
public Key getTopKey() {
return null;
}

@Override
public Value getTopValue() {
return null;
}

@Override
public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
return null;
}

@Override
public Key getFirstKey() {
Pair<Key,Key> pair = fakeFiles.get(filename);
if (pair == null)
return null;
return pair.getFirst();
}

@Override
public Key getLastKey() {
Pair<Key,Key> pair = fakeFiles.get(filename);
if (pair == null)
return null;
return pair.getSecond();
}

@Override
public DataInputStream getMetaStore(String name) {
return null;
}

@Override
public void closeDeepCopies() {}

@Override
public void close() {}

@Override
public FileSKVIterator getSample(SamplerConfigurationImpl sampleConfig) {
return null;
}

@Override
public void setCacheProvider(CacheProvider cacheProvider) {}

}

static final DefaultConfiguration dfault = DefaultConfiguration.getInstance();

private static class TestCompactionRequest extends MajorCompactionRequest {

Integer mfpt = null;

@Override
public FileSKVIterator openReader(TabletFile ref) {
return new TestFileSKVIterator(ref.toString());
}

TestCompactionRequest(KeyExtent extent, MajorCompactionReason reason,
Map<StoredTabletFile,DataFileValue> files) {
super(extent, reason, dfault, getServerContext());

0 comments on commit e52df66

Please sign in to comment.