[prev in list] [next in list] [prev in thread] [next in thread] 

List:       flume-commits
Subject:    git commit: FLUME-1918. File Channel cannot handle capacity of more than 500 Million events.
From:       mpercy () apache ! org
Date:       2013-02-15 2:57:22
Message-ID: 20130215025722.72B3A82B18C () tyr ! zones ! apache ! org
[Download RAW message or body]

Updated Branches:
  refs/heads/trunk 5294ee61e -> d898d7efd


FLUME-1918. File Channel cannot handle capacity of more than 500 Million events.

(Hari Shreedharan via Mike Percy)


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

Branch: refs/heads/trunk
Commit: d898d7efdf6b16554a07c55ede810ab930ec00c8
Parents: 5294ee6
Author: Mike Percy <mpercy@apache.org>
Authored: Thu Feb 14 18:55:21 2013 -0800
Committer: Mike Percy <mpercy@apache.org>
Committed: Thu Feb 14 18:55:21 2013 -0800

----------------------------------------------------------------------
 .../channel/file/EventQueueBackingStoreFile.java   |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/d898d7ef/flume-ng-channels/flume-fil \
                e-channel/src/main/java/org/apache/flume/channel/file/EventQueueBackingStoreFile.java
                
----------------------------------------------------------------------
diff --git a/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/EventQueueBackingStoreFile.java \
b/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/EventQueueBackingStoreFile.java
 index 7f35301..4115505 100644
--- a/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/EventQueueBackingStoreFile.java
                
+++ b/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/EventQueueBackingStoreFile.java
 @@ -62,7 +62,7 @@ abstract class EventQueueBackingStoreFile extends \
EventQueueBackingStore {  super(capacity, name);
     this.checkpointFile = checkpointFile;
     checkpointFileHandle = new RandomAccessFile(checkpointFile, "rw");
-    int totalBytes = (capacity + HEADER_SIZE) * Serialization.SIZE_OF_LONG;
+    long totalBytes = (capacity + HEADER_SIZE) * Serialization.SIZE_OF_LONG;
     if(checkpointFileHandle.length() == 0) {
       allocate(checkpointFile, totalBytes);
       checkpointFileHandle.seek(INDEX_VERSION * Serialization.SIZE_OF_LONG);
@@ -210,6 +210,10 @@ abstract class EventQueueBackingStoreFile extends \
EventQueueBackingStore {  boolean success = false;
     try {
       if (totalBytes <= MAX_ALLOC_BUFFER_SIZE) {
+        /*
+         * totalBytes <= MAX_ALLOC_BUFFER_SIZE, so this can be cast to int
+         * without a problem.
+         */
         checkpointFile.write(new byte[(int)totalBytes]);
       } else {
         byte[] initBuffer = new byte[MAX_ALLOC_BUFFER_SIZE];
@@ -218,6 +222,10 @@ abstract class EventQueueBackingStoreFile extends \
EventQueueBackingStore {  checkpointFile.write(initBuffer);
           remainingBytes -= MAX_ALLOC_BUFFER_SIZE;
         }
+        /*
+         * At this point, remainingBytes is < MAX_ALLOC_BUFFER_SIZE,
+         * so casting to int is fine.
+         */
         if (remainingBytes > 0) {
           checkpointFile.write(initBuffer, 0, (int)remainingBytes);
         }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic