flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject svn commit: r1363244 - in /flume/trunk/flume-ng-channels/flume-file-channel/src: main/java/org/apache/flume/channel/file/ test/java/org/apache/flume/channel/file/
Date Thu, 19 Jul 2012 06:54:44 GMT
Author: jarcec
Date: Thu Jul 19 06:54:43 2012
New Revision: 1363244

URL: http://svn.apache.org/viewvc?rev=1363244&view=rev
Log:
FLUME-1383. Improve various log messages in FileChannel and HDFSSink.

(Mike Percy via Jarek Jarcec Cecho)

Modified:
    flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/FileChannel.java
    flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/Log.java
    flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/LogFile.java
    flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/TransactionEventRecord.java
    flume/trunk/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestTransactionEventRecord.java

Modified: flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/FileChannel.java
URL: http://svn.apache.org/viewvc/flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/FileChannel.java?rev=1363244&r1=1363243&r2=1363244&view=diff
==============================================================================
--- flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/FileChannel.java
(original)
+++ flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/FileChannel.java
Thu Jul 19 06:54:43 2012
@@ -233,9 +233,12 @@ public class FileChannel extends BasicCh
           "Unable to acquire " + depth + " permits " + channelNameDescriptor);
       LOG.info("Queue Size after replay: " + depth + " "
            + channelNameDescriptor);
-    } catch (Exception ex) {
+    } catch (Throwable t) {
       open = false;
-      LOG.error("Failed to start the file channel", ex);
+      LOG.error("Failed to start the file channel " + channelNameDescriptor, t);
+      if (t instanceof Error) {
+        throw (Error) t;
+      }
     }
     if (open) {
       channelCounter.start();

Modified: flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/Log.java
URL: http://svn.apache.org/viewvc/flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/Log.java?rev=1363244&r1=1363243&r2=1363244&view=diff
==============================================================================
--- flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/Log.java
(original)
+++ flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/Log.java
Thu Jul 19 06:54:43 2012
@@ -197,7 +197,7 @@ class Log {
    * @throws IOException
    */
   void replay() throws IOException {
-    Preconditions.checkState(!open, "Cannot replay after Log as been opened");
+    Preconditions.checkState(!open, "Cannot replay after Log has been opened");
 
     checkpointWriterLock.lock();
 
@@ -262,7 +262,7 @@ class Log {
 
       open = true;
     } catch (Exception ex) {
-      LOGGER.error("Failed to initialize Log", ex);
+      LOGGER.error("Failed to initialize Log on " + channelNameDescriptor, ex);
       if (ex instanceof IOException) {
         throw (IOException) ex;
       }
@@ -339,7 +339,8 @@ class Log {
     try {
       lockAcquired = checkpointReadLock.tryLock(logWriteTimeout, TimeUnit.SECONDS);
     } catch (InterruptedException ex) {
-      LOGGER.warn("Interrupted while waiting for log write lock", ex);
+      LOGGER.warn("Interrupted while waiting for log write lock on " +
+          channelNameDescriptor, ex);
       Thread.currentThread().interrupt();
     }
 

Modified: flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/LogFile.java
URL: http://svn.apache.org/viewvc/flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/LogFile.java?rev=1363244&r1=1363243&r2=1363244&view=diff
==============================================================================
--- flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/LogFile.java
(original)
+++ flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/LogFile.java
Thu Jul 19 06:54:43 2012
@@ -366,6 +366,7 @@ class LogFile {
       }
     }
     Pair<Integer, TransactionEventRecord> next() throws IOException {
+      int offset = -1;
       try {
         long position = fileChannel.position();
         if (position > FileChannelConfiguration.DEFAULT_MAX_FILE_SIZE) {
@@ -373,7 +374,7 @@ class LogFile {
                 + FileChannelConfiguration.DEFAULT_MAX_FILE_SIZE
                 + ", position: " + position);
         }
-        int offset = (int) position;
+        offset = (int) position;
         byte operation = fileHandle.readByte();
         if(operation != OP_RECORD) {
           LOG.info("Encountered non op-record at " + offset);
@@ -385,6 +386,9 @@ class LogFile {
         return Pair.of(offset, record);
       } catch(EOFException e) {
         return null;
+      } catch (IOException e) {
+        throw new IOException("Unable to read next Transaction from log file " +
+            file.getCanonicalPath() + " at offset " + offset, e);
       }
     }
     void close() {

Modified: flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/TransactionEventRecord.java
URL: http://svn.apache.org/viewvc/flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/TransactionEventRecord.java?rev=1363244&r1=1363243&r2=1363244&view=diff
==============================================================================
--- flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/TransactionEventRecord.java
(original)
+++ flume/trunk/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/TransactionEventRecord.java
Thu Jul 19 06:54:43 2012
@@ -134,7 +134,7 @@ abstract class TransactionEventRecord im
     int header = in.readInt();
     if(header != MAGIC_HEADER) {
       throw new IOException("Header " + Integer.toHexString(header) +
-          " not expected value: " + Integer.toHexString(MAGIC_HEADER));
+          " is not the required value: " + Integer.toHexString(MAGIC_HEADER));
     }
     short type = in.readShort();
     long transactionID = in.readLong();

Modified: flume/trunk/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestTransactionEventRecord.java
URL: http://svn.apache.org/viewvc/flume/trunk/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestTransactionEventRecord.java?rev=1363244&r1=1363243&r2=1363244&view=diff
==============================================================================
--- flume/trunk/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestTransactionEventRecord.java
(original)
+++ flume/trunk/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestTransactionEventRecord.java
Thu Jul 19 06:54:43 2012
@@ -108,7 +108,7 @@ public class TestTransactionEventRecord 
       TransactionEventRecord.fromDataInput(toDataInput(0, in));
       Assert.fail();
     } catch (IOException e) {
-      Assert.assertEquals("Header 0 not expected value: deadbeef",
+      Assert.assertEquals("Header 0 is not the required value: deadbeef",
           e.getMessage());
     }
   }



Mime
View raw message