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:44:44 UTC

[lucene-solr] branch branch_8x 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 branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


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

commit 858b97a14453d56a636b6150891e7bcfbe01fd69
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 0bf21f6..ceb0e8f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -62,6 +62,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);
   }
 }