This is an automated email from the ASF dual-hosted git repository. dlmarion pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push: new 5cd2b91f37 Added property for setting setDropBehind on compaction input streams (#5473) 5cd2b91f37 is described below commit 5cd2b91f3716d4b8bb890dd4832db6190f342201 Author: Dave Marion <dlmar...@apache.org> AuthorDate: Mon Apr 14 16:26:24 2025 -0400 Added property for setting setDropBehind on compaction input streams (#5473) In #3079 we modified the FileCompactor to call FSDataInputStream.setDropBehind on compaction input files. Created a table property to allow the user to specify which file types should setDropBehind should be used with (default all). Calling setDropBehind on some files, like Bulk Import files and files assigned to src or dest tables as part of a clone operation, could cause an issue as the HDFS blocks for the files may not be in the page cache on the DataNode machine. --- .../org/apache/accumulo/core/conf/Property.java | 8 ++ .../accumulo/server/compaction/FileCompactor.java | 53 ++++++++-- .../apache/accumulo/server/fs/FileTypePrefix.java | 114 +++++++++++++++++++++ .../accumulo/server/fs/FileTypePrefixTest.java | 95 +++++++++++++++++ .../manager/tableOps/bulkVer2/PrepBulkImport.java | 5 +- .../tableOps/tableImport/MapImportFileNames.java | 4 +- .../tserver/tablet/MinorCompactionTask.java | 3 +- .../org/apache/accumulo/tserver/tablet/Tablet.java | 11 +- 8 files changed, 276 insertions(+), 17 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java b/core/src/main/java/org/apache/accumulo/core/conf/Property.java index f5ee557db2..eedd4c9970 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java @@ -1063,6 +1063,14 @@ public enum Property { "1.3.5"), TABLE_ARBITRARY_PROP_PREFIX("table.custom.", null, PropertyType.PREFIX, "Prefix to be used for user defined arbitrary properties.", "1.7.0"), + TABLE_COMPACTION_INPUT_DROP_CACHE_BEHIND("table.compaction.input.drop.cache", "*", + PropertyType.STRING, + "Sets FSDataInputStream.setDropBehind(true) is set on compaction" + + " input streams for the specified type of files. The value of this property is a comma-separated list of Accumulo" + + " file type prefixes ('A', 'C', 'F', 'I', and 'M'). The value '*' can be used to" + + " specify all file types (default). When the input file prefix matches a value in this list," + + " then setDropBehind will not be set on the FSDataInputStream.", + "2.1.4"), TABLE_MINC_OUTPUT_DROP_CACHE("table.compaction.minor.output.drop.cache", "false", PropertyType.BOOLEAN, "Setting this property to true will call" diff --git a/server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java b/server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java index 667c486f6d..b09050c1fb 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java +++ b/server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Date; +import java.util.EnumSet; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -45,6 +46,7 @@ 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.FileOperations; +import org.apache.accumulo.core.file.FileOperations.ReaderBuilder; import org.apache.accumulo.core.file.FileOperations.WriterBuilder; import org.apache.accumulo.core.file.FileSKVIterator; import org.apache.accumulo.core.file.FileSKVWriter; @@ -69,6 +71,7 @@ import org.apache.accumulo.core.util.LocalityGroupUtil; import org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError; import org.apache.accumulo.core.util.ratelimit.RateLimiter; import org.apache.accumulo.server.ServerContext; +import org.apache.accumulo.server.fs.FileTypePrefix; import org.apache.accumulo.server.fs.VolumeManager; import org.apache.accumulo.server.iterators.SystemIteratorEnvironment; import org.apache.accumulo.server.problems.ProblemReport; @@ -333,6 +336,21 @@ public class FileCompactor implements Callable<CompactionStats> { FileOperations fileFactory = FileOperations.getInstance(); FileSystem ns = this.fs.getFileSystemByPath(outputFile.getPath()); + // Normally you would not want the DataNode to continue to + // cache blocks in the page cache for compaction input files + // as these files are normally marked for deletion after a + // compaction occurs. However there can be cases where the + // compaction input files will continue to be used, like in + // the case of bulk import files which may be assigned to many + // tablets and will still be needed until all of the tablets + // have compacted, or in the case of cloned tables where one + // of the tables has compacted the input file but the other + // has not. + String dropCachePrefixProperty = + acuTableConf.get(Property.TABLE_COMPACTION_INPUT_DROP_CACHE_BEHIND); + final EnumSet<FileTypePrefix> dropCacheFilePrefixes = + FileTypePrefix.typesFromList(dropCachePrefixProperty); + final boolean isMinC = env.getIteratorScope() == IteratorUtil.IteratorScope.minc; final boolean dropCacheBehindOutput = !RootTable.ID.equals(this.extent.tableId()) @@ -357,13 +375,14 @@ public class FileCompactor implements Callable<CompactionStats> { if (mfw.supportsLocalityGroups()) { for (Entry<String,Set<ByteSequence>> entry : lGroups.entrySet()) { setLocalityGroup(entry.getKey()); - compactLocalityGroup(entry.getKey(), entry.getValue(), true, mfw, majCStats); + compactLocalityGroup(entry.getKey(), entry.getValue(), true, mfw, majCStats, + dropCacheFilePrefixes); allColumnFamilies.addAll(entry.getValue()); } } setLocalityGroup(""); - compactLocalityGroup(null, allColumnFamilies, false, mfw, majCStats); + compactLocalityGroup(null, allColumnFamilies, false, mfw, majCStats, dropCacheFilePrefixes); long t2 = System.currentTimeMillis(); @@ -447,8 +466,9 @@ public class FileCompactor implements Callable<CompactionStats> { } } - private List<SortedKeyValueIterator<Key,Value>> - openMapDataFiles(ArrayList<FileSKVIterator> readers) throws IOException { + private List<SortedKeyValueIterator<Key,Value>> openMapDataFiles( + ArrayList<FileSKVIterator> readers, EnumSet<FileTypePrefix> dropCacheFilePrefixes) + throws IOException { List<SortedKeyValueIterator<Key,Value>> iters = new ArrayList<>(filesToCompact.size()); @@ -459,10 +479,23 @@ public class FileCompactor implements Callable<CompactionStats> { FileSystem fs = this.fs.getFileSystemByPath(mapFile.getPath()); FileSKVIterator reader; - reader = fileFactory.newReaderBuilder() + boolean dropCacheBehindCompactionInputFile = false; + if (dropCacheFilePrefixes.contains(FileTypePrefix.ALL)) { + dropCacheBehindCompactionInputFile = true; + } else { + FileTypePrefix type = FileTypePrefix.fromFileName(mapFile.getFileName()); + if (dropCacheFilePrefixes.contains(type)) { + dropCacheBehindCompactionInputFile = true; + } + } + + ReaderBuilder readerBuilder = fileFactory.newReaderBuilder() .forFile(mapFile.getPathStr(), fs, fs.getConf(), cryptoService) - .withTableConfiguration(acuTableConf).withRateLimiter(env.getReadLimiter()) - .dropCachesBehind().build(); + .withTableConfiguration(acuTableConf).withRateLimiter(env.getReadLimiter()); + if (dropCacheBehindCompactionInputFile) { + readerBuilder.dropCachesBehind(); + } + reader = readerBuilder.build(); readers.add(reader); @@ -504,13 +537,15 @@ public class FileCompactor implements Callable<CompactionStats> { } private void compactLocalityGroup(String lgName, Set<ByteSequence> columnFamilies, - boolean inclusive, FileSKVWriter mfw, CompactionStats majCStats) + boolean inclusive, FileSKVWriter mfw, CompactionStats majCStats, + EnumSet<FileTypePrefix> dropCacheFilePrefixes) throws IOException, CompactionCanceledException { ArrayList<FileSKVIterator> readers = new ArrayList<>(filesToCompact.size()); Span compactSpan = TraceUtil.startSpan(this.getClass(), "compact"); try (Scope span = compactSpan.makeCurrent()) { long entriesCompacted = 0; - List<SortedKeyValueIterator<Key,Value>> iters = openMapDataFiles(readers); + List<SortedKeyValueIterator<Key,Value>> iters = + openMapDataFiles(readers, dropCacheFilePrefixes); if (env.getIteratorScope() == IteratorScope.minc) { iters.add(env.getMinCIterator()); diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/FileTypePrefix.java b/server/base/src/main/java/org/apache/accumulo/server/fs/FileTypePrefix.java new file mode 100644 index 0000000000..1d81796367 --- /dev/null +++ b/server/base/src/main/java/org/apache/accumulo/server/fs/FileTypePrefix.java @@ -0,0 +1,114 @@ +/* + * 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.server.fs; + +import java.util.EnumSet; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Preconditions; + +public enum FileTypePrefix { + + ALL("*"), + FLUSH("F"), + BULK_IMPORT("I"), + COMPACTION("C"), + FULL_COMPACTION("A"), + MERGING_MINOR_COMPACTION("M"), + UNKNOWN("?"); + + private static final Logger LOG = LoggerFactory.getLogger(FileTypePrefix.class); + + private final String filePrefix; + + private FileTypePrefix(String prefix) { + this.filePrefix = prefix; + } + + public String getPrefix() { + return filePrefix; + } + + public String createFileName(String fileName) { + Objects.requireNonNull(fileName, "filename must be supplied"); + Preconditions.checkArgument(!fileName.isBlank(), "Empty filename supplied"); + if (this == ALL || this == MERGING_MINOR_COMPACTION || this == UNKNOWN) { + throw new IllegalStateException( + "Unable to create filename with ALL, MERGING_MINOR_COMPACTION, or UNKNOWN prefix"); + } + return filePrefix + fileName; + } + + public static FileTypePrefix fromPrefix(String prefix) { + Objects.requireNonNull(prefix, "prefix must be supplied"); + Preconditions.checkArgument(!prefix.isBlank(), "Empty prefix supplied"); + Preconditions.checkArgument(prefix.length() == 1, "Invalid prefix supplied: " + prefix); + switch (prefix.toUpperCase()) { + case "A": + return FULL_COMPACTION; + case "C": + return COMPACTION; + case "F": + return FLUSH; + case "I": + return BULK_IMPORT; + case "M": + return MERGING_MINOR_COMPACTION; + default: + LOG.warn("Encountered unknown file prefix for file: {}", prefix); + return UNKNOWN; + } + } + + public static FileTypePrefix fromFileName(String fileName) { + Objects.requireNonNull(fileName, "file name must be supplied"); + Preconditions.checkArgument(!fileName.isBlank(), "Empty filename supplied"); + String firstChar = fileName.substring(0, 1); + if (!firstChar.equals(firstChar.toUpperCase())) { + throw new IllegalArgumentException( + "Expected first character of file name to be upper case, name: " + fileName); + } + return fromPrefix(firstChar); + } + + public static EnumSet<FileTypePrefix> typesFromList(String list) { + final EnumSet<FileTypePrefix> dropCacheFilePrefixes; + if (!list.isBlank()) { + if (list.contains("*")) { + dropCacheFilePrefixes = EnumSet.of(FileTypePrefix.ALL); + } else { + Set<FileTypePrefix> set = new HashSet<>(); + String[] prefixes = list.trim().split(","); + for (String p : prefixes) { + set.add(FileTypePrefix.fromPrefix(p.trim().toUpperCase())); + } + dropCacheFilePrefixes = EnumSet.copyOf(set); + } + } else { + dropCacheFilePrefixes = EnumSet.noneOf(FileTypePrefix.class); + } + return dropCacheFilePrefixes; + } + +} diff --git a/server/base/src/test/java/org/apache/accumulo/server/fs/FileTypePrefixTest.java b/server/base/src/test/java/org/apache/accumulo/server/fs/FileTypePrefixTest.java new file mode 100644 index 0000000000..7085e63777 --- /dev/null +++ b/server/base/src/test/java/org/apache/accumulo/server/fs/FileTypePrefixTest.java @@ -0,0 +1,95 @@ +/* + * 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.server.fs; + +import static org.apache.accumulo.server.fs.FileTypePrefix.ALL; +import static org.apache.accumulo.server.fs.FileTypePrefix.BULK_IMPORT; +import static org.apache.accumulo.server.fs.FileTypePrefix.COMPACTION; +import static org.apache.accumulo.server.fs.FileTypePrefix.FLUSH; +import static org.apache.accumulo.server.fs.FileTypePrefix.FULL_COMPACTION; +import static org.apache.accumulo.server.fs.FileTypePrefix.MERGING_MINOR_COMPACTION; +import static org.apache.accumulo.server.fs.FileTypePrefix.UNKNOWN; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.util.EnumSet; + +import org.junit.jupiter.api.Test; + +public class FileTypePrefixTest { + + @Test + public void testCreateFileName() { + assertThrows(NullPointerException.class, () -> FLUSH.createFileName(null)); + assertThrows(IllegalArgumentException.class, () -> FLUSH.createFileName("")); + assertThrows(IllegalStateException.class, () -> ALL.createFileName("file.rf")); + assertThrows(IllegalStateException.class, () -> UNKNOWN.createFileName("file.rf")); + assertThrows(IllegalStateException.class, + () -> MERGING_MINOR_COMPACTION.createFileName("file.rf")); + assertEquals("Afile.rf", FULL_COMPACTION.createFileName("file.rf")); + assertEquals("Cfile.rf", COMPACTION.createFileName("file.rf")); + assertEquals("Ffile.rf", FLUSH.createFileName("file.rf")); + assertEquals("Ifile.rf", BULK_IMPORT.createFileName("file.rf")); + } + + @Test + public void testFromPrefix() { + assertThrows(NullPointerException.class, () -> FileTypePrefix.fromPrefix(null)); + assertThrows(IllegalArgumentException.class, () -> FileTypePrefix.fromPrefix("")); + assertThrows(IllegalArgumentException.class, () -> FileTypePrefix.fromPrefix("AB")); + assertEquals(UNKNOWN, FileTypePrefix.fromPrefix("*")); + assertEquals(COMPACTION, FileTypePrefix.fromPrefix("c")); + assertEquals(COMPACTION, FileTypePrefix.fromPrefix("C")); + assertEquals(FULL_COMPACTION, FileTypePrefix.fromPrefix("a")); + assertEquals(FULL_COMPACTION, FileTypePrefix.fromPrefix("A")); + assertEquals(FLUSH, FileTypePrefix.fromPrefix("f")); + assertEquals(FLUSH, FileTypePrefix.fromPrefix("F")); + assertEquals(BULK_IMPORT, FileTypePrefix.fromPrefix("i")); + assertEquals(BULK_IMPORT, FileTypePrefix.fromPrefix("I")); + assertEquals(MERGING_MINOR_COMPACTION, FileTypePrefix.fromPrefix("m")); + assertEquals(MERGING_MINOR_COMPACTION, FileTypePrefix.fromPrefix("M")); + } + + @Test + public void fromFileName() { + assertThrows(NullPointerException.class, () -> FileTypePrefix.fromFileName(null)); + assertThrows(IllegalArgumentException.class, () -> FileTypePrefix.fromFileName("")); + assertEquals(UNKNOWN, FileTypePrefix.fromFileName("*file.rf")); + assertThrows(IllegalArgumentException.class, () -> FileTypePrefix.fromFileName("cfile.rf")); + assertEquals(COMPACTION, FileTypePrefix.fromFileName("Cfile.rf")); + assertThrows(IllegalArgumentException.class, () -> FileTypePrefix.fromFileName("afile.rf")); + assertEquals(FULL_COMPACTION, FileTypePrefix.fromFileName("Afile.rf")); + assertThrows(IllegalArgumentException.class, () -> FileTypePrefix.fromFileName("ffile.rf")); + assertEquals(FLUSH, FileTypePrefix.fromFileName("Ffile.rf")); + assertThrows(IllegalArgumentException.class, () -> FileTypePrefix.fromFileName("ifile.rf")); + assertEquals(BULK_IMPORT, FileTypePrefix.fromFileName("Ifile.rf")); + assertThrows(IllegalArgumentException.class, () -> FileTypePrefix.fromFileName("mfile.rf")); + assertEquals(MERGING_MINOR_COMPACTION, FileTypePrefix.fromFileName("Mfile.rf")); + + } + + @Test + public void testFromList() { + assertEquals(EnumSet.noneOf(FileTypePrefix.class), FileTypePrefix.typesFromList("")); + assertEquals(EnumSet.of(ALL), FileTypePrefix.typesFromList("*")); + assertEquals(EnumSet.of(ALL), FileTypePrefix.typesFromList("*, A")); + assertEquals(EnumSet.of(COMPACTION, FULL_COMPACTION), FileTypePrefix.typesFromList("C, A")); + } + +} diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/bulkVer2/PrepBulkImport.java b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/bulkVer2/PrepBulkImport.java index a8689034c0..3fa2c58758 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/bulkVer2/PrepBulkImport.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/bulkVer2/PrepBulkImport.java @@ -51,6 +51,7 @@ import org.apache.accumulo.manager.Manager; import org.apache.accumulo.manager.tableOps.ManagerRepo; import org.apache.accumulo.manager.tableOps.Utils; import org.apache.accumulo.server.ServerContext; +import org.apache.accumulo.server.fs.FileTypePrefix; import org.apache.accumulo.server.fs.VolumeManager; import org.apache.accumulo.server.tablets.UniqueNameAllocator; import org.apache.accumulo.server.zookeeper.TransactionWatcher; @@ -278,8 +279,8 @@ public class PrepBulkImport extends ManagerRepo { for (FileStatus file : files) { // since these are only valid files we know it has an extension - String newName = - "I" + namer.getNextName() + "." + FilenameUtils.getExtension(file.getPath().getName()); + String newName = FileTypePrefix.BULK_IMPORT.createFileName( + namer.getNextName() + "." + FilenameUtils.getExtension(file.getPath().getName())); oldToNewNameMap.put(file.getPath().getName(), new Path(bulkDir, newName).getName()); } diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/MapImportFileNames.java b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/MapImportFileNames.java index 5e5bd803d9..7032b578c7 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/MapImportFileNames.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/MapImportFileNames.java @@ -33,6 +33,7 @@ import org.apache.accumulo.core.fate.Repo; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.manager.Manager; import org.apache.accumulo.manager.tableOps.ManagerRepo; +import org.apache.accumulo.server.fs.FileTypePrefix; import org.apache.accumulo.server.fs.VolumeManager; import org.apache.accumulo.server.tablets.UniqueNameAllocator; import org.apache.hadoop.fs.FileStatus; @@ -86,7 +87,8 @@ class MapImportFileNames extends ManagerRepo { extension = Constants.MAPFILE_EXTENSION; } - String newName = "I" + namer.getNextName() + "." + extension; + String newName = + FileTypePrefix.BULK_IMPORT.createFileName(namer.getNextName() + "." + extension); mappingsWriter.append(fileName); mappingsWriter.append(':'); diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactionTask.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactionTask.java index 621283a9a6..addc0b93d7 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactionTask.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactionTask.java @@ -21,6 +21,7 @@ package org.apache.accumulo.tserver.tablet; import org.apache.accumulo.core.metadata.TabletFile; import org.apache.accumulo.core.metadata.schema.DataFileValue; import org.apache.accumulo.core.trace.TraceUtil; +import org.apache.accumulo.server.fs.FileTypePrefix; import org.apache.accumulo.tserver.MinorCompactionReason; import org.apache.hadoop.fs.Path; import org.slf4j.Logger; @@ -74,7 +75,7 @@ class MinorCompactionTask implements Runnable { while (true) { try { if (newFile == null) { - newFile = tablet.getNextMapFilename("F"); + newFile = tablet.getNextMapFilename(FileTypePrefix.FLUSH); tmpFile = new TabletFile(new Path(newFile.getPathStr() + "_tmp")); } /* diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java index 36b79b37d4..dd599b7dcf 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java @@ -97,6 +97,7 @@ import org.apache.accumulo.core.util.Pair; import org.apache.accumulo.core.volume.Volume; import org.apache.accumulo.server.ServerContext; import org.apache.accumulo.server.compaction.CompactionStats; +import org.apache.accumulo.server.fs.FileTypePrefix; import org.apache.accumulo.server.fs.VolumeChooserEnvironmentImpl; import org.apache.accumulo.server.fs.VolumeUtil; import org.apache.accumulo.server.fs.VolumeUtil.TabletFiles; @@ -264,14 +265,16 @@ public class Tablet extends TabletBase { return dirUri; } - TabletFile getNextMapFilename(String prefix) throws IOException { + TabletFile getNextMapFilename(FileTypePrefix prefix) throws IOException { String extension = FileOperations.getNewFileExtension(tableConfiguration); - return new TabletFile(new Path(chooseTabletDir() + "/" + prefix - + context.getUniqueNameAllocator().getNextName() + "." + extension)); + return new TabletFile(new Path(chooseTabletDir() + "/" + + prefix.createFileName(context.getUniqueNameAllocator().getNextName() + "." + extension))); } TabletFile getNextMapFilenameForMajc(boolean propagateDeletes) throws IOException { - String tmpFileName = getNextMapFilename(!propagateDeletes ? "A" : "C").getMetaInsert() + "_tmp"; + FileTypePrefix prefix = + !propagateDeletes ? FileTypePrefix.FULL_COMPACTION : FileTypePrefix.COMPACTION; + String tmpFileName = getNextMapFilename(prefix).getMetaInsert() + "_tmp"; return new TabletFile(new Path(tmpFileName)); }