Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relates to FLUME-583 #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions src/java/com/cloudera/flume/handlers/text/Cursor.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -351,28 +351,11 @@ private boolean readAllFromChannel() throws IOException, InterruptedException {
madeProgress = true; madeProgress = true;


// need char encoder to find line breaks in buf. // need char encoder to find line breaks in buf.
lastChannelPos += (rd < 0 ? 0 : rd); // rd == -1 if at end of lastChannelPos += rd;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rd can never be <=0 in this loop

// stream. // stream.

buf.flip();
int lastRd = 0; // extract lines
boolean progress = false; extractLines(buf);
do {

if (lastRd == -1 && rd == -1) {
return true;
}

buf.flip();

// extract lines
extractLines(buf);

lastRd = rd;
} while (progress); // / potential race

// if the amount read catches up to the size of the file, we can fall
// out and let another fileChannel be read. If the last buffer isn't
// read, then it remain in the byte buffer.


Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this loop runs only once

} }


Expand Down