chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asrab...@apache.org
Subject svn commit: r822860 - in /hadoop/chukwa/trunk: CHANGES.txt contrib/chukwa-pig/chukwa-pig.jar src/java/org/apache/hadoop/chukwa/util/DumpChunks.java src/java/org/apache/hadoop/chukwa/util/Filter.java src/test/org/apache/hadoop/chukwa/util/TestFilter.java
Date Wed, 07 Oct 2009 19:22:00 GMT
Author: asrabkin
Date: Wed Oct  7 19:22:00 2009
New Revision: 822860

URL: http://svn.apache.org/viewvc?rev=822860&view=rev
Log:
CHUKWA-397. Allow all as search pattern.

Modified:
    hadoop/chukwa/trunk/CHANGES.txt
    hadoop/chukwa/trunk/contrib/chukwa-pig/chukwa-pig.jar
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/DumpChunks.java
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/Filter.java
    hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/util/TestFilter.java

Modified: hadoop/chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/CHANGES.txt?rev=822860&r1=822859&r2=822860&view=diff
==============================================================================
--- hadoop/chukwa/trunk/CHANGES.txt (original)
+++ hadoop/chukwa/trunk/CHANGES.txt Wed Oct  7 19:22:00 2009
@@ -58,6 +58,8 @@
 
   IMPROVEMENTS
 
+    CHUKWA-397. Allow "all" as search pattern. (asrabkin)
+
     CHUKWA-393. Support using pig on Chunks. (asrabkin)
 
     CHUKWA-392.  FIFO queueing of threads in collector. (asrabkin)

Modified: hadoop/chukwa/trunk/contrib/chukwa-pig/chukwa-pig.jar
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/contrib/chukwa-pig/chukwa-pig.jar?rev=822860&r1=822859&r2=822860&view=diff
==============================================================================
Binary files - no diff available.

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=822860&r1=822859&r2=822860&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 Wed Oct  7
19:22:00 2009
@@ -84,7 +84,11 @@
       summarize = true;
     }
     
-    Filter patterns = new Filter(args[filterArg]);
+    Filter patterns;
+    if(args[filterArg].toLowerCase().equals("all"))
+      patterns = Filter.ALL;
+    else
+      patterns = new Filter(args[filterArg]);
 
     System.err.println("Patterns:" + patterns);
     ArrayList<Path> filesToSearch = new ArrayList<Path>();

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/Filter.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/Filter.java?rev=822860&r1=822859&r2=822860&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/Filter.java (original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/Filter.java Wed Oct  7 19:22:00
2009
@@ -105,7 +105,7 @@
     return true;
   }
   
-  public int size() {
+  int size() {
     return compiledPatterns.size();
   }
   
@@ -118,4 +118,20 @@
     }
     return sb.toString();
   }
+  
+  private static final class MatchAll extends Filter {
+    public MatchAll() {
+      super("datatype=.*");
+    }
+    
+    public boolean matches(Chunk c) {
+      return true;
+    }
+    
+    public String toString() {
+      return "ALL";
+    }
+  } 
+  public static final Filter ALL = new MatchAll();
+  
 }//end class

Modified: hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/util/TestFilter.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/util/TestFilter.java?rev=822860&r1=822859&r2=822860&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/util/TestFilter.java (original)
+++ hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/util/TestFilter.java Wed Oct  7
19:22:00 2009
@@ -29,18 +29,23 @@
      byte[] dat = "someText".getBytes();
      ChunkImpl chunkNone = new ChunkImpl("badData","aname", dat.length, dat, null);
      assertFalse(rules.matches(chunkNone));
+     assertTrue(Filter.ALL.matches(chunkNone));
+
 
        //do the right thing on a non-match
      ChunkImpl chunkSome = new ChunkImpl("badData", "aname", dat.length, dat, null);
      chunkSome.setSource("fooly");
      chunkSome.addTag("cluster=\"bar\"");
      assertFalse(rules.matches( chunkSome));
+     assertTrue(Filter.ALL.matches(chunkSome));
 
      ChunkImpl chunkAll = new ChunkImpl("Data", "aname", dat.length, dat, null);
      chunkAll.setSource("fooly");
      chunkAll.addTag("cluster=\"bar\"");
 
      assertTrue(rules.matches(chunkAll));
+     assertTrue(Filter.ALL.matches(chunkAll));
+
      
        //check that we match content correctly
      rules = new Filter("content=someText");
@@ -59,6 +64,7 @@
     byte[] dat = "someText".getBytes();
     ChunkImpl chunk1 = new ChunkImpl("Data", "aname", dat.length, dat, null);
     chunk1.setSource("asource");
+    assertTrue(Filter.ALL.matches(chunk1));
     Filter rule = new Filter("tags.foo=bar");
     
     assertFalse(rule.matches(chunk1));
@@ -66,6 +72,7 @@
     assertTrue(rule.matches(chunk1));
     chunk1.addTag("baz=\"quux\"");
     assertTrue(rule.matches(chunk1));
+    assertTrue(Filter.ALL.matches(chunk1));
   }
   
 }



Mime
View raw message