Skip to content

Commit

Permalink
Use InfoStream.NO_OUTPUT in PersistedClusterStateService
Browse files Browse the repository at this point in the history
We can save some allocations and speedup tests some more by using
`InfoStream.NO_OUTPUT` instead of the default `NullInfoStream` that does
not log but causes signals enabled to its users and thus causes
large strings to needlessly be setup.
  • Loading branch information
original-brownbear committed Sep 16, 2024
1 parent 49dcc16 commit b23962c
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.lucene.store.NIOFSDirectory;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.InfoStream;
import org.apache.lucene.util.SetOnce;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.ClusterState;
Expand Down Expand Up @@ -261,6 +262,7 @@ CheckedBiConsumer<Path, DirectoryReader, IOException> getAssertOnCommit() {

private static IndexWriter createIndexWriter(Directory directory, boolean openExisting) throws IOException {
final IndexWriterConfig indexWriterConfig = new IndexWriterConfig(new KeywordAnalyzer());
indexWriterConfig.setInfoStream(InfoStream.NO_OUTPUT);
// start empty since we re-write the whole cluster state to ensure it is all using the same format version
indexWriterConfig.setOpenMode(openExisting ? IndexWriterConfig.OpenMode.APPEND : IndexWriterConfig.OpenMode.CREATE);
// only commit when specifically instructed, we must not write any intermediate states
Expand Down

0 comments on commit b23962c

Please sign in to comment.