SOLR-6305: Replication from filesysem defaults, not from server defaults

Signed-off-by: Kevin Risden <krisden@apache.org>
This commit is contained in:
Boris Pasko 2018-04-03 18:12:05 -04:00 committed by Kevin Risden
parent c69548d39f
commit 858b97a144
No known key found for this signature in database
GPG Key ID: 040FAE3292C5F73F
2 changed files with 4 additions and 1 deletions

View File

@ -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
----------------------

View File

@ -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);
}
}