msokolov commented on a change in pull request #1764: URL: https://github.com/apache/lucene-solr/pull/1764#discussion_r474285099
########## File path: lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java ########## @@ -2023,4 +2023,44 @@ public void eval(MockDirectoryWrapper dir) throws IOException { dir.close(); } + + + public void testOnlyRollbackOnceOnException() throws IOException { + AtomicBoolean once = new AtomicBoolean(false); + InfoStream stream = new InfoStream() { + @Override + public void message(String component, String message) { + if ("TP".equals(component) && "rollback before checkpoint".equals(message)) { + if (once.compareAndSet(false, true)) { + throw new RuntimeException("boom"); + } else { + throw new AssertionError("has been rolled back twice"); + } + + } + } + + @Override + public boolean isEnabled(String component) { + return "TP".equals(component); + } + + @Override + public void close() { + } + }; + try (Directory dir = newDirectory()) { + try (IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig().setInfoStream(stream)){ + @Override + protected boolean isEnableTestPoints() { + return true; + } + }) { + } + } catch (RuntimeException x) { Review comment: I'm really happy there were no votes for runtimeException (IDE generated code fancult vote) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org