mannoopj commented on code in PR #20707:
URL: https://github.com/apache/kafka/pull/20707#discussion_r2578146398
##########
metadata/src/test/java/org/apache/kafka/metadata/storage/FormatterTest.java:
##########
@@ -168,9 +183,9 @@ public void testFormatterFailsOnUnwritableDirectory()
throws Exception {
try (TestEnv testEnv = new TestEnv(1)) {
new File(testEnv.directory(0)).setReadOnly();
FormatterContext formatter1 = testEnv.newFormatter();
- String expectedPrefix = "Error while writing meta.properties file";
+ String expectedPrefix = "Error creating temporary file, logDir =";
assertEquals(expectedPrefix,
- assertThrows(FormatterException.class,
+ assertThrows(UncheckedIOException.class,
Review Comment:
The `UncheckedIOException` is being thrown `FileRawSnapshotWriter.create`.
On trunk this is never called as `writeDynamicQuorumSnapshot` is never called
since it appears for this test we are operating under a static metadata
directory. But now with our changes in `Formatter` we will always call
`FileRawSnapshotWriter.create` (for controllers and combined mode). If we add
this to the code `formatter1.formatter.setWriteBootstrapSnapshot(false);` we go
back to returning to the original error but since this is caused by a change in
behavior that we want (calling `FileRawSnapshotWriter.create`) i changed the
desired exception. Or the other option is moving `copier.setWriteErrorHandler`
ahead of `copier.setPreWriteHandler` in `Formatter:doFormart` so its caught. I
will push this change but lmk if I should revert it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]