Skip to content

Commit

Permalink
Remove overrides for ramBuffer, compound file
Browse files Browse the repository at this point in the history
Reverts to the default Lucene behavior
  • Loading branch information
bryanlb committed Jun 2, 2022
1 parent 1504e69 commit 16644d9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ public class LuceneIndexStoreConfig {
// The name of the lucene log file.
public final String logFileName;

// Config to set the IndexWriterConfig.setRAMBufferSizeMB.
public final int ramBufferSizeMB;

// A flag that turns on internal logging.
public final boolean enableTracing;

Expand All @@ -47,26 +44,15 @@ public static Duration getRefreshDuration(final long refreshDurationSecs) {
}

public LuceneIndexStoreConfig(
Duration commitDuration,
Duration refreshDuration,
String indexRoot,
int ramBufferSizeMB,
boolean enableTracing) {
this(
commitDuration,
refreshDuration,
indexRoot,
DEFAULT_LOG_FILE_NAME,
ramBufferSizeMB,
enableTracing);
Duration commitDuration, Duration refreshDuration, String indexRoot, boolean enableTracing) {
this(commitDuration, refreshDuration, indexRoot, DEFAULT_LOG_FILE_NAME, enableTracing);
}

public LuceneIndexStoreConfig(
Duration commitDuration,
Duration refreshDuration,
String indexRoot,
String logFileName,
int ramBufferSizeMB,
boolean enableTracing) {
ensureTrue(
!(commitDuration.isZero() || commitDuration.isNegative()),
Expand All @@ -78,7 +64,6 @@ public LuceneIndexStoreConfig(
this.refreshDuration = refreshDuration;
this.indexRoot = indexRoot;
this.logFileName = logFileName;
this.ramBufferSizeMB = ramBufferSizeMB;
this.enableTracing = enableTracing;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static LuceneIndexStoreImpl makeLogStore(
// TODO: Chunk should create log store?
LuceneIndexStoreConfig indexStoreCfg =
new LuceneIndexStoreConfig(
commitInterval, refreshInterval, dataDirectory.getAbsolutePath(), 8, false);
commitInterval, refreshInterval, dataDirectory.getAbsolutePath(), false);

// TODO: set ignore property exceptions via CLI flag.
return new LuceneIndexStoreImpl(
Expand Down Expand Up @@ -139,8 +139,6 @@ private IndexWriterConfig buildIndexWriterConfig(
final IndexWriterConfig indexWriterCfg =
new IndexWriterConfig(analyzer)
.setOpenMode(IndexWriterConfig.OpenMode.CREATE)
.setRAMBufferSizeMB(config.ramBufferSizeMB)
.setUseCompoundFile(false)
.setMergeScheduler(new KalDBMergeScheduler(metricsRegistry))
.setIndexDeletionPolicy(snapshotDeletionPolicy);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,23 @@
public class LuceneIndexStoreConfigTest {
@Test(expected = IllegalArgumentException.class)
public void testZeroCommitDuration() {
new LuceneIndexStoreConfig(
Duration.ZERO, Duration.ofSeconds(10), "indexRoot", "logfile", 20, true);
new LuceneIndexStoreConfig(Duration.ZERO, Duration.ofSeconds(10), "indexRoot", "logfile", true);
}

@Test(expected = IllegalArgumentException.class)
public void testZeroRefreshDuration() {
new LuceneIndexStoreConfig(
Duration.ofSeconds(10), Duration.ZERO, "indexRoot", "logfile", 20, true);
new LuceneIndexStoreConfig(Duration.ofSeconds(10), Duration.ZERO, "indexRoot", "logfile", true);
}

@Test(expected = IllegalArgumentException.class)
public void testNegativeCommitDuration() {
new LuceneIndexStoreConfig(
Duration.ofSeconds(-10), Duration.ofSeconds(10), "indexRoot", "logfile", 20, true);
Duration.ofSeconds(-10), Duration.ofSeconds(10), "indexRoot", "logfile", true);
}

@Test(expected = IllegalArgumentException.class)
public void testNegativeRefreshDuration() {
new LuceneIndexStoreConfig(
Duration.ofSeconds(10), Duration.ofSeconds(-100), "indexRoot", "logfile", 20, true);
Duration.ofSeconds(10), Duration.ofSeconds(-100), "indexRoot", "logfile", true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public TemporaryLogStoreAndSearcherRule(
public static LuceneIndexStoreConfig getIndexStoreConfig(
Duration commitInterval, Duration refreshInterval, File tempFolder) throws IOException {
return new LuceneIndexStoreConfig(
commitInterval, refreshInterval, tempFolder.getCanonicalPath(), 8, false);
commitInterval, refreshInterval, tempFolder.getCanonicalPath(), false);
}

@Override
Expand Down

0 comments on commit 16644d9

Please sign in to comment.