Apache Lucene open-source search software
SOLR-6305: Replication from filesysem defaults, not from server defaults
Boris Pasko901f381c6172
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 03279b7a3e8..99c81b9abaa 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.javaindex 9111c2c334f..fda1b3e6422 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);}}