Browse Source

Delegate write.lock to primary directory

Simon Willnauer 11 years ago
parent
commit
d6ae832c90

+ 2 - 1
src/main/java/org/elasticsearch/index/store/DistributorDirectory.java

@@ -19,6 +19,7 @@
 package org.elasticsearch.index.store;
 
 import org.apache.lucene.index.IndexFileNames;
+import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.store.*;
 import org.apache.lucene.util.IOUtils;
 import org.elasticsearch.common.math.MathUtils;
@@ -148,7 +149,7 @@ public final class DistributorDirectory extends BaseDirectory {
      * Returns true if the primary directory should be used for the given file.
      */
     private boolean usePrimary(String name) {
-        return IndexFileNames.SEGMENTS_GEN.equals(name) || Store.isChecksum(name);
+        return IndexFileNames.SEGMENTS_GEN.equals(name) || Store.isChecksum(name) || IndexWriter.WRITE_LOCK_NAME.equals(name);
     }
 
     /**

+ 1 - 1
src/test/java/org/elasticsearch/index/store/StoreTest.java

@@ -507,7 +507,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
 
     }
 
-    public void assertDeleteContent(Store store,DirectoryService service) throws IOException {
+    public void assertDeleteContent(Store store, DirectoryService service) throws IOException {
         store.deleteContent();
         assertThat(Arrays.toString(store.directory().listAll()), store.directory().listAll().length, equalTo(0));
         assertThat(store.stats().sizeInBytes(), equalTo(0l));