You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kr...@apache.org on 2019/08/02 22:43:58 UTC

[lucene-solr] branch master updated: SOLR-6305: Replication from filesysem defaults, not from server defaults

This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new 901f381  SOLR-6305: Replication from filesysem defaults, not from server defaults
901f381 is described below

commit 901f381c617233e1613421134178bd3559c3a58d
Author: Boris Pasko <bp...@outsideiq.com>
AuthorDate: Tue Apr 3 18:12:05 2018 -0400

    SOLR-6305: Replication from filesysem defaults, not from server defaults
    
    Signed-off-by: Kevin Risden <kr...@apache.org>
---
 solr/CHANGES.txt                                                  | 2 ++
 solr/core/src/java/org/apache/solr/store/hdfs/HdfsFileWriter.java | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 03279b7..99c81b9 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -112,6 +112,8 @@ Improvements
 
 * SOLR-13558: Allow dynamic resizing of SolrCache-s. (ab)
 
+* SOLR-6305: Ability to set the replication factor for index files created by HDFSDirectoryFactory (Boris Pasko via Kevin Risden)
+
 Bug Fixes
 ----------------------
 
diff --git a/solr/core/src/java/org/apache/solr/store/hdfs/HdfsFileWriter.java b/solr/core/src/java/org/apache/solr/store/hdfs/HdfsFileWriter.java
index 9111c2c..fda1b3e 100644
--- a/solr/core/src/java/org/apache/solr/store/hdfs/HdfsFileWriter.java
+++ b/solr/core/src/java/org/apache/solr/store/hdfs/HdfsFileWriter.java
@@ -43,6 +43,7 @@ public class HdfsFileWriter extends OutputStreamIndexOutput {
   private static final OutputStream getOutputStream(FileSystem fileSystem, Path path) throws IOException {
     Configuration conf = fileSystem.getConf();
     FsServerDefaults fsDefaults = fileSystem.getServerDefaults(path);
+    short replication = fileSystem.getDefaultReplication(path);
     EnumSet<CreateFlag> flags = EnumSet.of(CreateFlag.CREATE,
         CreateFlag.OVERWRITE);
     if (Boolean.getBoolean(HDFS_SYNC_BLOCK)) {
@@ -50,7 +51,7 @@ public class HdfsFileWriter extends OutputStreamIndexOutput {
     }
     return fileSystem.create(path, FsPermission.getDefault()
         .applyUMask(FsPermission.getUMask(conf)), flags, fsDefaults
-        .getFileBufferSize(), fsDefaults.getReplication(), fsDefaults
+        .getFileBufferSize(), replication, fsDefaults
         .getBlockSize(), null);
   }
 }