add yet another test

This commit is contained in:
Simon Willnauer 2016-01-12 21:17:14 +01:00
parent 5204440471
commit 050afe9171
2 changed files with 9 additions and 2 deletions

View File

@ -556,7 +556,7 @@ public class IndexShard extends AbstractIndexShardComponent {
/** Writes all indexing changes to disk and opens a new searcher reflecting all changes. This can throw {@link EngineClosedException}. */
public void refresh(String source) {
verifyNotClosed();
// if (getEngine().refreshNeeded()) {
if (getEngine().refreshNeeded()) {
if (canIndex()) {
long bytes = getEngine().getIndexBufferRAMBytesUsed();
writingBytes.addAndGet(bytes);
@ -575,7 +575,7 @@ public class IndexShard extends AbstractIndexShardComponent {
getEngine().refresh(source);
refreshMetric.inc(System.nanoTime() - time);
}
// }
}
}
/** Returns how many bytes we are currently moving from heap to disk */

View File

@ -322,6 +322,13 @@ public class IndexServiceTests extends ESSingleNodeTestCase {
assertBusy(() -> {
assertFalse(shard.getTranslog().syncNeeded());
});
}
public void testNoFsyncTaskIfDisabled() {
Settings settings = Settings.builder()
.put(IndexSettings.INDEX_TRANSLOG_SYNC_INTERVAL, "0ms") // disable
.build();
IndexService indexService = createIndex("test", settings);
assertNull(indexService.getFsyncTask());
}
}