Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

APEXMALHAR-2195 - Fix LineReaderContext last record #372

Conversation

yogidevendra
Copy link
Contributor

  1. Changes in the test app

@yogidevendra
Copy link
Contributor Author

@amberarrow Could you please review this?

@amberarrow
Copy link
Contributor

Ok, over the weekend.

@@ -89,15 +89,20 @@ public void testDelimitedRecords() throws Exception
lma.prepareDAG(app, conf);
LocalMode.Controller lc = lma.getController();
lc.setHeartbeatMonitoringEnabled(true);
lc.runAsync();
lc.run(10 * 1000);
LOG.debug("Waiting for app to finish");
Thread.sleep(1000 * 1);
lc.shutdown();
Copy link
Contributor

Choose a reason for hiding this comment

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

lc.shutdown is not required if you are using lc.run with time > 0

@yogidevendra yogidevendra force-pushed the APEXMALHAR-2195-LineReaderContext-last-record branch from accc093 to 05e7f5c Compare August 18, 2016 06:45
@yogidevendra yogidevendra reopened this Aug 18, 2016
@yogidevendra
Copy link
Contributor Author

@gauravgopi123 Incorporated your review comments. Could you please have a look?

while (posInStr < strBuffer.length()) {
char c = strBuffer.charAt(posInStr);
while (posInStr < bufferStr.length()) {
char c = bufferStr.charAt(posInStr);
if (c != '\r' && c != '\n') {
tmpBuilder.write(c);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is lossy write to tmpBuilder using ByteArrayOutputStream.write(int). byte[] to String conversion (line 193) is based on default encoding. In case default encoding where multiple bytes are required to store chars, this will lead to lose of data...

After looking at the code little more, I also found that code can be simplified a lot and we can get rid of tmpBuilder and emptyBuilder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gauravgopi123 How about creating separate JIRA for addressing this issue?
We can have in-depth discussion on the issues, alternatives, possible solutions on the new JIRA.

Copy link
Contributor

Choose a reason for hiding this comment

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

@yogidevendra What does it take to address the tmpBuilder issue now? Does not seem to require elaborate discussion. I would also prefer to get it fixed but if you are not able to work on it then take it up for next release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tweise I will prefer to work on it later. Also, I have some possible alternative in my mind which I will propose in the new JIRA.
I have created new JIRA APEXMALHAR-2198 for this.

@yogidevendra
Copy link
Contributor Author

@gauravgopi123 @amberarrow any comments?

@amberarrow
Copy link
Contributor

@yogidevendra It'll probably be another week before I can look at this, swamped currently.

@gauravgopi123
Copy link
Contributor

@yogidevendra : Any reason to rush for this fix? If you plan to use LineReaderContext with only your fix, it will still be buggy. So I suggest that you fix the other issue and merge with this PR.

@yogidevendra
Copy link
Contributor Author

yogidevendra commented Aug 23, 2016

@gauravgopi123 here are some reasons:

  1. We can pull this fix for malhar 3.5 release if new JIRA is created for the other problems you mentioned.
  2. I have another PR in examples repo which is dependent on this fix.
  3. Splitting the JIRA would help in better tracking, discussion focus.

@amberarrow @tweise Any opinions on separate JIRA?

@@ -89,15 +89,18 @@ public void testDelimitedRecords() throws Exception
lma.prepareDAG(app, conf);
LocalMode.Controller lc = lma.getController();
lc.setHeartbeatMonitoringEnabled(true);
lc.runAsync();
lc.run(10 * 1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please implement proper test termination. This topic was discussed elsewhere before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tweise updated to handle proper test termination.

@yogidevendra yogidevendra force-pushed the APEXMALHAR-2195-LineReaderContext-last-record branch from 05e7f5c to b708b89 Compare August 24, 2016 06:02
@tweise
Copy link
Contributor

tweise commented Aug 26, 2016

Your branch is behind by 18 commits. Please run git rebase apache/master to rebase.

@yogidevendra yogidevendra changed the title APEXMALHAR-2195 - Fixing LineReaderContext Issue APEXMALHAR-2195 - Fix LineReaderContext last record Aug 26, 2016
@yogidevendra yogidevendra force-pushed the APEXMALHAR-2195-LineReaderContext-last-record branch from b708b89 to 6ace0b2 Compare August 26, 2016 04:37
@yogidevendra yogidevendra reopened this Aug 26, 2016
@tweise
Copy link
Contributor

tweise commented Aug 26, 2016

@yogidevendra it looks like your upstream repo is the github mirror and not the asf repo. That would explain why there is the last commit missing. In the future please pull from the asf repo as sometimes sync to the mirror is delayed (saw it happening twice since yesterday).

@yogidevendra yogidevendra force-pushed the APEXMALHAR-2195-LineReaderContext-last-record branch from 6ace0b2 to c0af266 Compare August 26, 2016 07:06
@yogidevendra
Copy link
Contributor Author

@tweise updated after rebase with asf. But, I noticed travis build is in pending state for long time for last few builds. Any clues?

@asfgit asfgit merged commit c0af266 into apache:master Aug 26, 2016
@tweise
Copy link
Contributor

tweise commented Aug 26, 2016

Yes, Travis builds also take really long. Not sure why.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants