flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject git commit: FLUME-1534. CheckpointRebuilder$ComparableFlumeEventPointer#equal does not work correctly.
Date Sun, 02 Sep 2012 22:47:44 GMT
Updated Branches:
  refs/heads/trunk cbd12b63f -> 2379006bc


FLUME-1534. CheckpointRebuilder$ComparableFlumeEventPointer#equal does
not work correctly.

(Hari Shreedharan via Will McQueen)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/2379006b
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/2379006b
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/2379006b

Branch: refs/heads/trunk
Commit: 2379006bccd4b90e161d6a2c57f87755711354c8
Parents: cbd12b6
Author: Will McQueen <will@cloudera.com>
Authored: Sun Sep 2 15:30:21 2012 -0700
Committer: Will McQueen <will@cloudera.com>
Committed: Sun Sep 2 15:30:21 2012 -0700

----------------------------------------------------------------------
 .../flume/channel/file/CheckpointRebuilder.java    |   19 +++++++++++++-
 1 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/2379006b/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/CheckpointRebuilder.java
----------------------------------------------------------------------
diff --git a/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/CheckpointRebuilder.java
b/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/CheckpointRebuilder.java
index 4db1b9c..32b5324 100644
--- a/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/CheckpointRebuilder.java
+++ b/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/CheckpointRebuilder.java
@@ -18,6 +18,7 @@
  */
 package org.apache.flume.channel.file;
 
+import com.google.common.base.Preconditions;
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.Lists;
 import com.google.common.collect.SetMultimap;
@@ -146,9 +147,12 @@ public class CheckpointRebuilder {
     }
     Set<ComparableFlumeEventPointer> sortedPuts =
             Sets.newTreeSet(committedPuts);
+    int count = 0;
     for (ComparableFlumeEventPointer put : sortedPuts) {
       queue.addTail(put.pointer);
+      count++;
     }
+    LOG.info("Replayed {} events using fast replay logic.", count);
     return true;
   }
 
@@ -178,13 +182,15 @@ public class CheckpointRebuilder {
     }
   }
 
-  private class ComparableFlumeEventPointer
+  private final class ComparableFlumeEventPointer
           implements Comparable<ComparableFlumeEventPointer> {
 
     private final FlumeEventPointer pointer;
     private final long orderID;
 
     public ComparableFlumeEventPointer(FlumeEventPointer pointer, long orderID){
+      Preconditions.checkNotNull(pointer, "FlumeEventPointer cannot be"
+              + "null while creating a ComparableFlumeEventPointer");
       this.pointer = pointer;
       this.orderID = orderID;
     }
@@ -206,7 +212,16 @@ public class CheckpointRebuilder {
 
     @Override
     public boolean equals(Object o){
-      return pointer.equals(o);
+      if(this == o){
+        return true;
+      }
+      if(o == null){
+        return false;
+      }
+      if(o.getClass() != this.getClass()){
+        return false;
+      }
+      return pointer.equals(((ComparableFlumeEventPointer)o).pointer);
     }
   }
 


Mime
View raw message