Default to not using compound file format for the index (increases number of open files, but faster indexing and recovery), closes #384.

This commit is contained in:
kimchy 2010-09-24 11:46:41 +02:00
parent 2f43af0bd7
commit 485f904140
5 changed files with 12 additions and 10 deletions

View File

@ -40,6 +40,8 @@ import java.io.IOException;
*/ */
public abstract class FsStore extends AbstractStore { public abstract class FsStore extends AbstractStore {
public static final boolean DEFAULT_SUGGEST_USE_COMPOUND_FILE = false;
public FsStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore) { public FsStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore) {
super(shardId, indexSettings, indexStore); super(shardId, indexSettings, indexStore);
} }

View File

@ -60,12 +60,12 @@ public class MmapFsStore extends FsStore {
if (switchDirectory.v2() != null) { if (switchDirectory.v2() != null) {
suggestUseCompoundFile = switchDirectory.v2(); suggestUseCompoundFile = switchDirectory.v2();
} }
logger.debug("Using [mmap_fs] Store with path [{}], cache [true] with extensions [{}]", fsDirectory.getFile(), switchDirectory.v1().primaryExtensions()); logger.debug("using [mmap_fs] store with path [{}], cache [true] with extensions [{}]", fsDirectory.getFile(), switchDirectory.v1().primaryExtensions());
directory = wrapDirectory(switchDirectory.v1()); directory = wrapDirectory(switchDirectory.v1());
} else { } else {
suggestUseCompoundFile = true; suggestUseCompoundFile = DEFAULT_SUGGEST_USE_COMPOUND_FILE;
directory = wrapDirectory(fsDirectory); directory = wrapDirectory(fsDirectory);
logger.debug("Using [mmap_fs] Store with path [{}]", fsDirectory.getFile()); logger.debug("using [mmap_fs] store with path [{}]", fsDirectory.getFile());
} }
this.suggestUseCompoundFile = suggestUseCompoundFile; this.suggestUseCompoundFile = suggestUseCompoundFile;
} }

View File

@ -60,12 +60,12 @@ public class NioFsStore extends FsStore {
if (switchDirectory.v2() != null) { if (switchDirectory.v2() != null) {
suggestUseCompoundFile = switchDirectory.v2(); suggestUseCompoundFile = switchDirectory.v2();
} }
logger.debug("Using [nio_fs] Store with path [{}], cache [true] with extensions [{}]", fsDirectory.getFile(), switchDirectory.v1().primaryExtensions()); logger.debug("using [nio_fs] store with path [{}], cache [true] with extensions [{}]", fsDirectory.getFile(), switchDirectory.v1().primaryExtensions());
directory = wrapDirectory(switchDirectory.v1()); directory = wrapDirectory(switchDirectory.v1());
} else { } else {
suggestUseCompoundFile = true; suggestUseCompoundFile = DEFAULT_SUGGEST_USE_COMPOUND_FILE;
directory = wrapDirectory(fsDirectory); directory = wrapDirectory(fsDirectory);
logger.debug("Using [nio_fs] Store with path [{}]", fsDirectory.getFile()); logger.debug("using [nio_fs] store with path [{}]", fsDirectory.getFile());
} }
this.suggestUseCompoundFile = suggestUseCompoundFile; this.suggestUseCompoundFile = suggestUseCompoundFile;
} }

View File

@ -60,12 +60,12 @@ public class SimpleFsStore extends FsStore {
if (switchDirectory.v2() != null) { if (switchDirectory.v2() != null) {
suggestUseCompoundFile = switchDirectory.v2(); suggestUseCompoundFile = switchDirectory.v2();
} }
logger.debug("Using [simple_fs] Store with path [{}], cache [true] with extensions [{}]", fsDirectory.getFile(), switchDirectory.v1().primaryExtensions()); logger.debug("using [simple_fs] store with path [{}], cache [true] with extensions [{}]", fsDirectory.getFile(), switchDirectory.v1().primaryExtensions());
directory = wrapDirectory(switchDirectory.v1()); directory = wrapDirectory(switchDirectory.v1());
} else { } else {
suggestUseCompoundFile = true; suggestUseCompoundFile = DEFAULT_SUGGEST_USE_COMPOUND_FILE;
directory = wrapDirectory(fsDirectory); directory = wrapDirectory(fsDirectory);
logger.debug("Using [simple_fs] Store with path [{}]", fsDirectory.getFile()); logger.debug("using [simple_fs] store with path [{}]", fsDirectory.getFile());
} }
this.suggestUseCompoundFile = suggestUseCompoundFile; this.suggestUseCompoundFile = suggestUseCompoundFile;
} }

View File

@ -55,7 +55,7 @@ public abstract class AbstractStore extends AbstractIndexShardComponent implemen
protected AbstractStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore) { protected AbstractStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore) {
super(shardId, indexSettings); super(shardId, indexSettings);
this.indexStore = indexStore; this.indexStore = indexStore;
this.sync = componentSettings.getAsBoolean("sync", false); this.sync = componentSettings.getAsBoolean("sync", true); // TODO we don't really need to fsync when using shared gateway...
} }
protected Directory wrapDirectory(Directory dir) throws IOException { protected Directory wrapDirectory(Directory dir) throws IOException {