fix seeking at the wrong place

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

Branch: refs/heads/trunk
Commit: 128177c41248734e76499ef382152fd3c40378bd
Parents: 2130633
Author: Yuki Morishita <[email protected]>
Authored: Wed Apr 3 19:30:53 2013 -0500
Committer: Yuki Morishita <[email protected]>
Committed: Wed Apr 3 19:30:53 2013 -0500

----------------------------------------------------------------------
 .../compress/CompressedFileStreamTask.java         |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/128177c4/src/java/org/apache/cassandra/streaming/compress/CompressedFileStreamTask.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/cassandra/streaming/compress/CompressedFileStreamTask.java
 
b/src/java/org/apache/cassandra/streaming/compress/CompressedFileStreamTask.java
index 2551ca0..60f5a00 100644
--- 
a/src/java/org/apache/cassandra/streaming/compress/CompressedFileStreamTask.java
+++ 
b/src/java/org/apache/cassandra/streaming/compress/CompressedFileStreamTask.java
@@ -77,6 +77,9 @@ public class CompressedFileStreamTask extends FileStreamTask
             // stream each of the required sections of the file
             for (Pair<Long, Long> section : sections)
             {
+                // seek to the beginning of the section when socket channel is 
not available
+                if (sc == null)
+                    file.seek(section.left);
                 // length of the section to stream
                 long length = section.right - section.left;
                 // tracks write progress
@@ -92,7 +95,6 @@ public class CompressedFileStreamTask extends FileStreamTask
                     }
                     else
                     {
-                        file.seek(section.left);
                         // NIO is not available. Fall back to normal streaming.
                         // This happens when inter-node encryption is turned 
on.
                         if (transferBuffer == null)

Reply via email to