chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asrab...@apache.org
Subject svn commit: r781205 - in /hadoop/chukwa/trunk: CHANGES.txt src/java/org/apache/hadoop/chukwa/datacollection/writer/SeqFileWriter.java
Date Tue, 02 Jun 2009 23:06:11 GMT
Author: asrabkin
Date: Tue Jun  2 23:06:11 2009
New Revision: 781205

URL: http://svn.apache.org/viewvc?rev=781205&view=rev
Log:
CHUKWA-137. Add collector IP to dataSink file name. Contributed by Jerome Boulon.

Modified:
    hadoop/chukwa/trunk/CHANGES.txt
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/writer/SeqFileWriter.java

Modified: hadoop/chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/CHANGES.txt?rev=781205&r1=781204&r2=781205&view=diff
==============================================================================
--- hadoop/chukwa/trunk/CHANGES.txt (original)
+++ hadoop/chukwa/trunk/CHANGES.txt Tue Jun  2 23:06:11 2009
@@ -14,6 +14,8 @@
 
   IMPROVEMENTS
 
+    CHUKWA-137. Add collector IP to the dataSink fileName. (Jerome Boulon via asrabkin)
+
     CHUKWA-258. More detailed logging of SQL errors. (asrabkin)
 
     CHUKWA-30.  Remove HDFS flush and connection holding in Collector. (Jerome Boulon via
asrabkin)

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/writer/SeqFileWriter.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/writer/SeqFileWriter.java?rev=781205&r1=781204&r2=781205&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/writer/SeqFileWriter.java
(original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/writer/SeqFileWriter.java
Tue Jun  2 23:06:11 2009
@@ -20,8 +20,10 @@
 
 
 import java.io.IOException;
+import java.net.InetAddress;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.net.UnknownHostException;
 import java.util.Calendar;
 import java.util.List;
 import java.util.Timer;
@@ -46,6 +48,8 @@
   public static final boolean ENABLE_ROTATION = true;
 
   static final int STAT_INTERVAL_SECONDS = 30;
+  static String localHostAddr = null;
+  
   static final Object lock = new Object();
 
   static Logger log = Logger.getLogger(SeqFileWriter.class);
@@ -76,9 +80,17 @@
   private int writeChunkRetries = initWriteChunkRetries;
   private boolean chunksWrittenThisRotate = false;
 
+  static {
+    try {
+      localHostAddr = "_" + InetAddress.getLocalHost().getHostName() + "_";
+    } catch (UnknownHostException e) {
+      localHostAddr = "-NA-";
+    }
+  }
+  
   public SeqFileWriter() throws WriterException {
   }
-
+  
   public void init(Configuration conf) throws WriterException {
     outputDir = conf.get("chukwaCollector.outputDir", "/chukwa");
 
@@ -190,7 +202,7 @@
 
     String newName = new java.text.SimpleDateFormat("yyyyddHHmmssSSS")
         .format(calendar.getTime());
-    newName += "_" + new java.rmi.server.UID().toString();
+    newName += localHostAddr + new java.rmi.server.UID().toString();
     newName = newName.replace("-", "");
     newName = newName.replace(":", "");
     newName = newName.replace(".", "");



Mime
View raw message