Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduced default compaction configuration down to one group #4299

Merged
merged 5 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions assemble/bin/accumulo-cluster
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,7 @@ tserver:
- localhost

compactor:
accumulo_meta:
- localhost
user_small:
- localhost
user_large:
default:
- localhost

sserver:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public enum Property {
COMPACTION_SERVICE_ROOT_MAX_OPEN(COMPACTION_SERVICE_PREFIX + "root.planner.opts.maxOpen", "30",
PropertyType.COUNT, "The maximum number of files a compaction will open.", "4.0.0"),
COMPACTION_SERVICE_ROOT_GROUPS(COMPACTION_SERVICE_PREFIX + "root.planner.opts.groups",
"[{'name':'accumulo_meta'}]".replaceAll("'", "\""), PropertyType.STRING,
"[{'group':'default'}]".replaceAll("'", "\""), PropertyType.JSON,
"See {% jlink -f org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner %}.",
"4.0.0"),
COMPACTION_SERVICE_META_PLANNER(COMPACTION_SERVICE_PREFIX + "meta.planner",
Expand All @@ -74,7 +74,7 @@ public enum Property {
COMPACTION_SERVICE_META_MAX_OPEN(COMPACTION_SERVICE_PREFIX + "meta.planner.opts.maxOpen", "30",
PropertyType.COUNT, "The maximum number of files a compaction will open.", "4.0.0"),
COMPACTION_SERVICE_META_GROUPS(COMPACTION_SERVICE_PREFIX + "meta.planner.opts.groups",
"[{'name':'accumulo_meta'}]".replaceAll("'", "\""), PropertyType.JSON,
"[{'group':'default'}]".replaceAll("'", "\""), PropertyType.JSON,
"See {% jlink -f org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner %}.",
"4.0.0"),
COMPACTION_SERVICE_DEFAULT_PLANNER(COMPACTION_SERVICE_PREFIX + "default.planner",
Expand All @@ -83,8 +83,7 @@ public enum Property {
COMPACTION_SERVICE_DEFAULT_MAX_OPEN(COMPACTION_SERVICE_PREFIX + "default.planner.opts.maxOpen",
"10", PropertyType.COUNT, "The maximum number of files a compaction will open.", "4.0.0"),
COMPACTION_SERVICE_DEFAULT_GROUPS(COMPACTION_SERVICE_PREFIX + "default.planner.opts.groups",
("[{'name':'user_small','maxSize':'128M'}, {'name':'user_large'}]").replaceAll("'", "\""),
PropertyType.STRING,
("[{'group':'default'}]").replaceAll("'", "\""), PropertyType.JSON,
"See {% jlink -f org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner %}.",
"4.0.0"),
COMPACTION_WARN_TIME(COMPACTION_PREFIX + "warn.time", "10m", PropertyType.TIMEDURATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
* <th>Description</th>
* </tr>
* <tr>
* <td>name</td>
* <td>name of the compactor group (required)</td>
* <td>group</td>
* <td>name of the compactor resource group (required)</td>
* </tr>
* <tr>
* <td>maxSize</td>
Expand All @@ -97,9 +97,9 @@
* <pre>
* {@code
* [
* {"name":"small", "maxSize":"100M"},
* {"name":"medium", "maxSize":"500M"},
* {"name": "large"}
* {"group":"small", "maxSize":"100M"},
* {"group":"medium", "maxSize":"500M"},
* {"group": "large"}
* ]}
* </pre>
* </ul>
Expand Down Expand Up @@ -127,7 +127,7 @@ public class DefaultCompactionPlanner implements CompactionPlanner {
private final static Logger log = LoggerFactory.getLogger(DefaultCompactionPlanner.class);

private static class GroupConfig {
String name;
String group;
String maxSize;
}

Expand Down Expand Up @@ -192,7 +192,7 @@ public void init(InitParameters params) {
: ConfigurationTypeHelper.getFixedMemoryAsBytes(groupConfig.maxSize);

CompactorGroupId cgid;
String group = Objects.requireNonNull(groupConfig.name, "'name' must be specified");
String group = Objects.requireNonNull(groupConfig.group, "'group' must be specified");
dlmarion marked this conversation as resolved.
Show resolved Hide resolved
cgid = params.getGroupManager().getGroup(group);
tmpGroups.add(new CompactionGroup(cgid, maxSize));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public void testFindFilesToCompact() {

@Test
public void testRunningCompaction() {
String groups = "[{'name':'small','maxSize':'32M'}, {'name':'medium','maxSize':'128M'},"
+ "{'name':'large','maxSize':'512M'}, {'name':'huge'}]";
String groups = "[{'group':'small','maxSize':'32M'}, {'group':'medium','maxSize':'128M'},"
+ "{'group':'large','maxSize':'512M'}, {'group':'huge'}]";

var planner = createPlanner(defaultConf, groups);

Expand Down Expand Up @@ -187,8 +187,8 @@ public void testUserCompaction() {
aconf.set(prefix + "cs1.planner.opts.maxOpen", "15");
ConfigurationImpl config = new ConfigurationImpl(aconf);

String groups = "[{'name':'small','maxSize':'32M'}, {'name':'medium','maxSize':'128M'},"
+ "{'name':'large','maxSize':'512M'}, {'name':'huge'}]";
String groups = "[{'group':'small','maxSize':'32M'}, {'group':'medium','maxSize':'128M'},"
+ "{'group':'large','maxSize':'512M'}, {'group':'huge'}]";

var planner = createPlanner(config, groups);
var all = createCFs("F1", "3M", "F2", "3M", "F3", "11M", "F4", "12M", "F5", "13M");
Expand Down Expand Up @@ -256,8 +256,8 @@ public void testUserCompaction() {

@Test
public void testMaxSize() {
String groups = "[{'name':'small','maxSize':'32M'}, {'name':'medium','maxSize':'128M'},"
+ "{'name':'large','maxSize':'512M'}]";
String groups = "[{'group':'small','maxSize':'32M'}, {'group':'medium','maxSize':'128M'},"
+ "{'group':'large','maxSize':'512M'}]";

var planner = createPlanner(defaultConf, groups);
var all = createCFs("F1", "128M", "F2", "129M", "F3", "130M", "F4", "131M", "F5", "132M");
Expand All @@ -281,8 +281,8 @@ public void testMaxSize() {
public void testMultipleCompactions() {
// This test validates that when a tablet has many files that multiple compaction jobs can be
// issued at the same time.
String groups = "[{'name':'small','maxSize':'32M'}, {'name':'medium','maxSize':'128M'},"
+ "{'name':'large','maxSize':'512M'}]";
String groups = "[{'group':'small','maxSize':'32M'}, {'group':'medium','maxSize':'128M'},"
+ "{'group':'large','maxSize':'512M'}]";

for (var kind : List.of(CompactionKind.USER, CompactionKind.SYSTEM)) {
var planner = createPlanner(defaultConf, groups);
Expand Down Expand Up @@ -315,8 +315,8 @@ public void testMultipleCompactions() {
@Test
public void testMultipleCompactionsAndLargeCompactionRatio() {

String groups = "[{'name':'small','maxSize':'32M'}, {'name':'medium','maxSize':'128M'},"
+ "{'name':'large','maxSize':'512M'}]";
String groups = "[{'group':'small','maxSize':'32M'}, {'group':'medium','maxSize':'128M'},"
+ "{'group':'large','maxSize':'512M'}]";
var planner = createPlanner(defaultConf, groups);
var all = IntStream.range(0, 65).mapToObj(i -> createCF("F" + i, i + 1)).collect(toSet());
// This compaction ratio would not cause a system compaction, how a user compaction must compact
Expand Down Expand Up @@ -349,8 +349,8 @@ public void testMultipleCompactionsAndRunningCompactions() {
// This test validates that when a tablet has many files that multiple compaction jobs can be
// issued at the same time even if there are running compaction as long everything meets the
// compaction ratio.
String groups = "[{'name':'small','maxSize':'32M'}, {'name':'medium','maxSize':'128M'},"
+ "{'name':'large','maxSize':'512M'}]";
String groups = "[{'group':'small','maxSize':'32M'}, {'group':'medium','maxSize':'128M'},"
+ "{'group':'large','maxSize':'512M'}]";
for (var kind : List.of(CompactionKind.USER, CompactionKind.SYSTEM)) {
var planner = createPlanner(defaultConf, groups);
var all = IntStream.range(0, 990).mapToObj(i -> createCF("F" + i, 1000)).collect(toSet());
Expand Down Expand Up @@ -391,8 +391,8 @@ public void testMultipleCompactionsAndRunningCompactions() {
public void testUserCompactionDoesNotWaitOnSystemCompaction() {
// this test ensures user compactions do not wait on system compactions to complete

String groups = "[{'name':'small','maxSize':'32M'}, {'name':'medium','maxSize':'128M'},"
+ "{'name':'large','maxSize':'512M'}]";
String groups = "[{'group':'small','maxSize':'32M'}, {'group':'medium','maxSize':'128M'},"
+ "{'group':'large','maxSize':'512M'}]";
var planner = createPlanner(defaultConf, groups);
var all = createCFs("F1", "1M", "F2", "1M", "F3", "1M", "F4", "3M", "F5", "3M", "F6", "3M",
"F7", "20M");
Expand Down Expand Up @@ -435,7 +435,7 @@ public void testUserCompactionDoesNotWaitOnSystemCompaction() {
public void testQueueCreation() {
DefaultCompactionPlanner planner = new DefaultCompactionPlanner();

String groups = "[{\"name\": \"small\", \"maxSize\":\"32M\"},{\"name\":\"midsize\"}]";
String groups = "[{\"group\": \"small\", \"maxSize\":\"32M\"},{\"group\":\"midsize\"}]";
planner.init(getInitParams(defaultConf, groups));

var all = createCFs("F1", "1M", "F2", "1M", "F3", "1M", "F4", "1M");
Expand Down Expand Up @@ -463,7 +463,7 @@ public void testErrorAdditionalConfigFields() {
DefaultCompactionPlanner planner = new DefaultCompactionPlanner();

String groups =
"[{\"name\":\"smallQueue\", \"maxSize\":\"32M\"}, {\"name\":\"largeQueue\", \"type\":\"internal\", \"foo\":\"bar\", \"queue\":\"broken\"}]";
"[{\"group\":\"smallQueue\", \"maxSize\":\"32M\"}, {\"group\":\"largeQueue\", \"type\":\"internal\", \"foo\":\"bar\", \"queue\":\"broken\"}]";

final InitParameters params = getInitParams(defaultConf, groups);
assertNotNull(params);
Expand All @@ -480,14 +480,15 @@ public void testErrorAdditionalConfigFields() {
@Test
public void testErrorGroupNoName() {
DefaultCompactionPlanner planner = new DefaultCompactionPlanner();
String groups = "[{\"name\":\"smallQueue\", \"maxSize\":\"32M\"}, {\"maxSize\":\"120M\"}]";
String groups = "[{\"group\":\"smallQueue\", \"maxSize\":\"32M\"}, {\"maxSize\":\"120M\"}]";

final InitParameters params = getInitParams(defaultConf, groups);
assertNotNull(params);

var e = assertThrows(NullPointerException.class, () -> planner.init(params),
"Failed to throw error");
assertEquals(e.getMessage(), "'name' must be specified", "Error message didn't contain 'name'");
assertEquals(e.getMessage(), "'group' must be specified",
"Error message didn't contain 'group'");
}

/**
Expand All @@ -512,7 +513,7 @@ public void testErrorNoGroups() {
public void testErrorOnlyOneMaxSize() {
DefaultCompactionPlanner planner = new DefaultCompactionPlanner();
String groups =
"[{\"name\":\"small\", \"maxSize\":\"32M\"}, {\"name\":\"medium\"}, {\"name\":\"large\"}]";
"[{\"group\":\"small\", \"maxSize\":\"32M\"}, {\"group\":\"medium\"}, {\"group\":\"large\"}]";
var e = assertThrows(IllegalArgumentException.class,
() -> planner.init(getInitParams(defaultConf, groups)), "Failed to throw error");
assertTrue(e.getMessage().contains("Can only have one group w/o a maxSize"),
Expand All @@ -526,7 +527,7 @@ public void testErrorOnlyOneMaxSize() {
public void testErrorDuplicateMaxSize() {
DefaultCompactionPlanner planner = new DefaultCompactionPlanner();
String groups =
"[{\"name\":\"small\", \"maxSize\":\"32M\"}, {\"name\":\"medium\", \"maxSize\":\"32M\"}, {\"name\":\"large\"}]";
"[{\"group\":\"small\", \"maxSize\":\"32M\"}, {\"group\":\"medium\", \"maxSize\":\"32M\"}, {\"group\":\"large\"}]";
var e = assertThrows(IllegalArgumentException.class,
() -> planner.init(getInitParams(defaultConf, groups)), "Failed to throw error");
assertTrue(e.getMessage().contains("Duplicate maxSize set in groups"),
Expand All @@ -538,8 +539,8 @@ public void testErrorDuplicateMaxSize() {
// compaction.
@Test
public void testMaxTabletFiles() {
String groups = "[{'name':'small','maxSize':'32M'}, {'name':'medium','maxSize':'128M'},"
+ "{'name':'large'}]";
String groups = "[{'group':'small','maxSize':'32M'}, {'group':'medium','maxSize':'128M'},"
+ "{'group':'large'}]";

Map<String,String> overrides = new HashMap<>();
overrides.put(Property.COMPACTION_SERVICE_PREFIX.getKey() + "cs1.planner.opts.maxOpen", "10");
Expand Down Expand Up @@ -614,8 +615,8 @@ public void testMaxTabletFiles() {

@Test
public void testMaxTabletFilesNoCompaction() {
String groups = "[{'name':'small','maxSize':'32M'}, {'name':'medium','maxSize':'128M'},"
+ "{'name':'large', 'maxSize':'512M'}]";
String groups = "[{'group':'small','maxSize':'32M'}, {'group':'medium','maxSize':'128M'},"
+ "{'group':'large', 'maxSize':'512M'}]";

Map<String,String> overrides = new HashMap<>();
overrides.put(Property.COMPACTION_SERVICE_PREFIX.getKey() + "cs1.planner.opts.maxOpen", "10");
Expand Down Expand Up @@ -651,8 +652,8 @@ public void testMaxTabletFilesNoCompaction() {
// Test to ensure that plugin falls back from TABLE_FILE_MAX to TSERV_SCAN_MAX_OPENFILES
@Test
public void testMaxTableFilesFallback() {
String groups = "[{'name':'small','maxSize':'32M'}, {'name':'medium','maxSize':'128M'},"
+ "{'name':'large'}]";
String groups = "[{'group':'small','maxSize':'32M'}, {'group':'medium','maxSize':'128M'},"
+ "{'group':'large'}]";

Map<String,String> overrides = new HashMap<>();
overrides.put(Property.COMPACTION_SERVICE_PREFIX.getKey() + "cs1.planner.opts.maxOpen", "10");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public void test() throws Exception {
public void testDebugPorts() {

Set<Pair<ServerType,Integer>> debugPorts = accumulo.getDebugPorts();
assertEquals(10, debugPorts.size());
assertEquals(7, debugPorts.size());
for (Pair<ServerType,Integer> debugPort : debugPorts) {
assertTrue(debugPort.getSecond() > 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public void testValidInput1() throws Exception {
String inputString = ("compaction.service.cs1.planner="
+ "org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner \n"
+ "compaction.service.cs1.planner.opts.groups=\\\n"
+ "[{'name':'small','maxSize':'16M'},{'name':'medium','maxSize':'128M'},\\\n"
+ "{'name':'large'}]").replaceAll("'", "\"");
+ "[{'group':'small','maxSize':'16M'},{'group':'medium','maxSize':'128M'},\\\n"
+ "{'group':'large'}]").replaceAll("'", "\"");

String filePath = writeToFileAndReturnPath(inputString);

Expand All @@ -65,12 +65,12 @@ public void testValidInput2() throws Exception {
String inputString = ("compaction.service.cs1.planner="
+ "org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner \n"
+ "compaction.service.cs1.planner.opts.groups=\\\n"
+ "[{'name':'small','maxSize':'16M'},{'name':'medium','maxSize':'128M'},\\\n"
+ "{'name':'large'}] \ncompaction.service.cs2.planner="
+ "[{'group':'small','maxSize':'16M'},{'group':'medium','maxSize':'128M'},\\\n"
+ "{'group':'large'}] \ncompaction.service.cs2.planner="
+ "org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner \n"
+ "compaction.service.cs2.planner.opts.groups=\\\n"
+ "[{'name':'small','maxSize':'16M'},{'name':'medium','maxSize':'128M'},\\\n"
+ "{'name':'large'}]").replaceAll("'", "\"");
+ "[{'group':'small','maxSize':'16M'},{'group':'medium','maxSize':'128M'},\\\n"
+ "{'group':'large'}]").replaceAll("'", "\"");

String filePath = writeToFileAndReturnPath(inputString);

Expand All @@ -82,15 +82,15 @@ public void testValidInput3() throws Exception {
String inputString = ("compaction.service.cs1.planner="
+ "org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner \n"
+ "compaction.service.cs1.planner.opts.groups=\\\n"
+ "[{'name':'small','maxSize':'16M'},{'name':'medium','maxSize':'128M'},\\\n"
+ "{'name':'large'}] \ncompaction.service.cs2.planner="
+ "[{'group':'small','maxSize':'16M'},{'group':'medium','maxSize':'128M'},\\\n"
+ "{'group':'large'}] \ncompaction.service.cs2.planner="
+ "org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner \n"
+ "compaction.service.cs2.planner.opts.groups=\\\n"
+ "[{'name':'small','maxSize':'16M'}, {'name':'medium','maxSize':'128M'},\\\n"
+ "{'name':'large'}] \ncompaction.service.cs3.planner="
+ "[{'group':'small','maxSize':'16M'}, {'group':'medium','maxSize':'128M'},\\\n"
+ "{'group':'large'}] \ncompaction.service.cs3.planner="
+ "org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner \n"
+ "compaction.service.cs3.planner.opts.groups=\\\n"
+ "[{'name':'small','maxSize':'16M'},{'name':'large'}]").replaceAll("'", "\"");
+ "[{'group':'small','maxSize':'16M'},{'group':'large'}]").replaceAll("'", "\"");

String filePath = writeToFileAndReturnPath(inputString);
CheckCompactionConfig.main(new String[] {filePath});
Expand All @@ -101,8 +101,8 @@ public void testThrowsInvalidFieldsError() throws IOException {
String inputString = ("compaction.service.cs1.planner="
+ "org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner \n"
+ "compaction.service.cs1.planner.opts.groups=\\\n"
+ "[{'name':'small','maxSize':'16M'},{'name':'medium','maxSize':'128M'},\\\n"
+ "{'name':'large','numThreads':2}]").replaceAll("'", "\"");
+ "[{'group':'small','maxSize':'16M'},{'group':'medium','maxSize':'128M'},\\\n"
+ "{'group':'large','numThreads':2}]").replaceAll("'", "\"");
String expectedErrorMsg =
"Invalid fields: [numThreads] provided for class: org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner$GroupConfig";

Expand All @@ -116,8 +116,8 @@ public void testThrowsInvalidFieldsError() throws IOException {
@Test
public void testNoPlanner() throws Exception {
String inputString = ("compaction.service.cs1.planner.opts.groups=\\\n"
+ "[{'name':'small','maxSize':'16M'}, {'name':'medium','maxSize':'128M'},\\\n"
+ "{'name':'large'}]").replaceAll("'", "\"");
+ "[{'group':'small','maxSize':'16M'}, {'group':'medium','maxSize':'128M'},\\\n"
+ "{'group':'large'}]").replaceAll("'", "\"");
String expectedErrorMsg =
"Incomplete compaction service definitions, missing planner class [cs1]";

Expand All @@ -133,8 +133,8 @@ public void testRepeatedCompactionGroup() throws Exception {
String inputString = ("compaction.service.cs1.planner="
+ "org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner \n"
+ "compaction.service.cs1.planner.opts.groups=\\\n"
+ "[{'name':'small','maxSize':'16M'},{'name':'medium','maxSize':'128M'},\\\n"
+ "{'name':'small'}]").replaceAll("'", "\"");
+ "[{'group':'small','maxSize':'16M'},{'group':'medium','maxSize':'128M'},\\\n"
+ "{'group':'small'}]").replaceAll("'", "\"");
String expectedErrorMsg = "Duplicate compactor group for group: small";

final String filePath = writeToFileAndReturnPath(inputString);
Expand All @@ -149,8 +149,8 @@ public void testInvalidMaxSize() throws Exception {
String inputString = ("compaction.service.cs1.planner="
+ "org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner \n"
+ "compaction.service.cs1.planner.opts.groups=\\\n"
+ "[{'name':'small','maxSize':'16M'},{'name':'medium','maxSize':'0M'},\\\n"
+ "{'name':'large'}]").replaceAll("'", "\"");
+ "[{'group':'small','maxSize':'16M'},{'group':'medium','maxSize':'0M'},\\\n"
+ "{'group':'large'}]").replaceAll("'", "\"");
String expectedErrorMsg = "Invalid value for maxSize";

String filePath = writeToFileAndReturnPath(inputString);
Expand Down
Loading