-
Notifications
You must be signed in to change notification settings - Fork 453
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
handles failure in compaction planner #4586
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,6 +152,21 @@ public CompactionPlan makePlan(PlanningParameters params) { | |
} | ||
} | ||
|
||
public static class ErroringPlanner implements CompactionPlanner { | ||
@Override | ||
public void init(InitParameters params) { | ||
if (Boolean.parseBoolean(params.getOptions().getOrDefault("failInInit", "false"))) { | ||
throw new IllegalStateException("error initializing"); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public CompactionPlan makePlan(PlanningParameters params) { | ||
throw new IllegalStateException("error planning"); | ||
} | ||
} | ||
|
||
public static class CompactionExecutorITConfig implements MiniClusterConfigurationCallback { | ||
@Override | ||
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration conf) { | ||
|
@@ -177,6 +192,16 @@ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration conf) | |
cfg.setProperty(csp + "cs4.planner.opts.filesPerCompaction", "11"); | ||
cfg.setProperty(csp + "cs4.planner.opts.process", "USER"); | ||
|
||
// Setup three planner that fail to initialize or plan, these planners should not impede | ||
// tablet assignment. | ||
cfg.setProperty(csp + "cse1.planner", ErroringPlanner.class.getName()); | ||
cfg.setProperty(csp + "cse1.planner.opts.failInInit", "true"); | ||
|
||
cfg.setProperty(csp + "cse2.planner", ErroringPlanner.class.getName()); | ||
cfg.setProperty(csp + "cse2.planner.opts.failInInit", "false"); | ||
|
||
cfg.setProperty(csp + "cse3.planner", "NonExistentPlanner20240522"); | ||
|
||
// this is meant to be dynamically reconfigured | ||
cfg.setProperty(csp + "recfg.planner", TestPlanner.class.getName()); | ||
cfg.setProperty(csp + "recfg.planner.opts.groups", "[{'group':'i1'},{'group':'i2'}]"); | ||
|
@@ -230,6 +255,35 @@ public void cleanup() { | |
} | ||
} | ||
|
||
@Test | ||
public void testFailingPlanners() throws Exception { | ||
// This test ensures that a table w/ failing compaction planner can still be read and written. | ||
|
||
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) { | ||
createTable(client, "fail1", "cse1"); | ||
createTable(client, "fail2", "cse2"); | ||
createTable(client, "fail3", "cse3"); | ||
|
||
// ensure tablets can still be assigned and written w/ failing compaction services | ||
addFiles(client, "fail1", 30); | ||
addFiles(client, "fail2", 30); | ||
addFiles(client, "fail3", 30); | ||
|
||
// ensure tablets can still be assigned and scanned w/ failing compaction services | ||
assertEquals(30, scanTable(client, "fail1").size()); | ||
assertEquals(30, scanTable(client, "fail2").size()); | ||
assertEquals(30, scanTable(client, "fail3").size()); | ||
|
||
// compactions should never run on these tables, but sleep a bit to be sure | ||
Thread.sleep(2000); | ||
|
||
// do no expect any compactions to run | ||
assertEquals(30, getFiles(client, "fail1").size()); | ||
assertEquals(30, getFiles(client, "fail2").size()); | ||
assertEquals(30, getFiles(client, "fail3").size()); | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI, if you wanted to test that the ERROR logging is being emitted (that the escalation is happening), you can look at https://github.com/apache/accumulo/blob/main/core/src/test/java/org/apache/accumulo/core/logging/EscalatingLoggerTest.java. I was able to figure out how to programatically change the logger and capture the output in a Java object that you can then test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, I have wanted to check logging in unit test in the past but did not know how. Looked around and there is currently no unit test for CompactionJobGenerator. Would need to add one to test logging, could be something to look into as a follow on. |
||
@Test | ||
public void testReconfigureCompactionService() throws Exception { | ||
Stream.of("i1", "i2").forEach(g -> { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious if you can use the EscalatingLogger ( or some other variant of ConditionalLogger) that's included in #4558 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use EscalatingLogger in 5500afb. Ran the new IT in this PR and looked at the logs and the changes are working. I was wondering if the exception some of the log messages had would be included in the key created from arguments in ConditionalLogger. Poked around a bit and found its not included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think the exception needs to be in the Key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if there is a downside to having too many ConditionalLoggers, as there is a Caffeine cache for each one. I wonder if it would be better to have one and add the logger name to the key.