Github user justinleet commented on a diff in the pull request:
https://github.com/apache/metron/pull/585#discussion_r116741150
--- Diff:
metron-platform/metron-pcap-backend/src/main/java/org/apache/metron/spout/pcap/PartitionHDFSWriter.java
---
@@ -102,14 +106,43 @@ public void sync(FSDataOutputStream input) throws
IOException {
private SyncHandler syncHandler;
private long batchStartTime;
private long numWritten;
+ private Configuration fsConfig = new Configuration();
public PartitionHDFSWriter(String topic, int partition, String uuid,
HDFSWriterConfig config) {
this.topic = topic;
this.partition = partition;
this.uuid = uuid;
this.config = config;
+
try {
- this.fs = FileSystem.get(new Configuration());
+ int replicationFactor = config.getReplicationFactor();
+ if (replicationFactor != -1) {
+ fsConfig.set("dfs.replication",
(String.valueOf(replicationFactor)));
+ }
+ if(config.getHDFSConfig() != null &&
!config.getHDFSConfig().isEmpty()) {
+ for(Map.Entry<String, Object> entry :
config.getHDFSConfig().entrySet()) {
+ if(entry.getValue() instanceof Integer) {
--- End diff --
Under the hood, don't all these fsConfig.setX calls just call
String.valueOf()? I'm not sure if that relationship (being all String under
the hood is guaranteed or just an implementation detail), but if it is, this
if-else chain simplifies significantly. I'll dig in a bit to see if there is.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---