chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asrab...@apache.org
Subject svn commit: r908184 - in /hadoop/chukwa/trunk: CHANGES.txt src/java/org/apache/hadoop/chukwa/util/DumpChunks.java
Date Tue, 09 Feb 2010 19:57:56 GMT
Author: asrabkin
Date: Tue Feb  9 19:57:55 2010
New Revision: 908184

URL: http://svn.apache.org/viewvc?rev=908184&view=rev
Log:
CHUKWA-450. Ability to turn off sort in dumpchunks.

Modified:
    hadoop/chukwa/trunk/CHANGES.txt
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/DumpChunks.java

Modified: hadoop/chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/CHANGES.txt?rev=908184&r1=908183&r2=908184&view=diff
==============================================================================
--- hadoop/chukwa/trunk/CHANGES.txt (original)
+++ hadoop/chukwa/trunk/CHANGES.txt Tue Feb  9 19:57:55 2010
@@ -28,6 +28,8 @@
  
    IMPROVEMENTS
 
+    CHUKWA-450. Ability to turn off sort in dumpchunks. (asrabkin)
+
     CHUKWA-359. Report detailed error on adaptor start failure. (asrabkin)
 
     CHUKWA-420. Clean up adaptor stop methods. (asrabkin)

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/DumpChunks.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/DumpChunks.java?rev=908184&r1=908183&r2=908184&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/DumpChunks.java (original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/DumpChunks.java Tue Feb  9
19:57:55 2010
@@ -51,12 +51,8 @@
       System.exit(-1);
     }
     
-    for(int i=1; i < args.length; ++i)
-        System.err.println("FileGlob: " + args[i]);
-
     ChukwaConfiguration conf = new ChukwaConfiguration();
 
-
     dump(args, conf, System.out);
   }
   
@@ -79,9 +75,13 @@
     
     int filterArg = 0;
     boolean summarize = false;
+    boolean nosort = false;
     if(args[0].equals("-s")) {
       filterArg++;
       summarize = true;
+    } else if(args[0].equals("--nosort")) {
+      filterArg++;
+      nosort = true;
     }
     
     Filter patterns;
@@ -93,7 +93,6 @@
     System.err.println("Patterns:" + patterns);
     ArrayList<Path> filesToSearch = new ArrayList<Path>();
 
-
     FileSystem fs = getFS(conf, args[filterArg + 1]);
     for(int i=filterArg + 1; i < args.length; ++i){
       Path[] globbedPaths = FileUtil.stat2Paths(fs.globStatus(new Path(args[i])));
@@ -107,7 +106,9 @@
     DumpChunks dc;
     if(summarize)
       dc = new DumpAndSummarize();
-    else 
+    else if(nosort)
+      dc = new DumpNoSort(out);
+    else
       dc= new DumpChunks();
     
     try {
@@ -168,7 +169,7 @@
     }
   }
  
-  protected void updateMatchCatalog(String streamName,  ChunkImpl chunk) {
+  protected void updateMatchCatalog(String streamName,  ChunkImpl chunk) throws IOException
{
 
     SortedMap<Long, ChunkImpl> chunksInStream = matchCatalog.get(streamName);
     if(chunksInStream == null ) {
@@ -217,5 +218,22 @@
     }
     
   }
+  
+  static class DumpNoSort extends DumpChunks {
+    
+    PrintStream out; 
+    public DumpNoSort(PrintStream out) {
+      this.out = out;
+    }
+    //Do some display
+    protected void updateMatchCatalog(String streamName,  ChunkImpl chunk) throws IOException
{
+      out.write(chunk.getData());
+    }
+    
+    protected void displayResults(PrintStream out) throws IOException{
+      ; //did this in updateMatchCatalog
+    }
+    
+  }
 
 }



Mime
View raw message