Skip to content

MINIFICPP-706 - RawSiteToSite: remove code duplication#470

Closed
arpadboda wants to merge 1 commit intoapache:masterfrom
arpadboda:MINIFICPP-706
Closed

MINIFICPP-706 - RawSiteToSite: remove code duplication#470
arpadboda wants to merge 1 commit intoapache:masterfrom
arpadboda:MINIFICPP-706

Conversation

@arpadboda
Copy link
Contributor

Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically master)?

  • Is your initial contribution a single, squashed commit?

For code changes:

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file?
  • If applicable, have you updated the NOTICE file?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

Note:

Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.

@phrocker
Copy link
Contributor

phrocker commented Jan 9, 2019

Changes inherently look fine. Will run some tests before approval. Hope to send an email soon re a release so I'll wait for 0.7 to merge it. Thanks

@arpadboda arpadboda force-pushed the MINIFICPP-706 branch 2 times, most recently from 21321d9 to 90640e7 Compare January 11, 2019 12:10
}

int RawSiteToSiteClient::readRespond(const std::shared_ptr<Transaction> &transaction, RespondCode &code, std::string &message) {
uint8_t firstByte;
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 again the case where the base class doesn't need to deal with the the innards of reading bytes. Probably means they can be removed from the base and made pure virtual since I believe they are overridden in http site to site if I'm not mistaken.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the case.
The implementation here was similar to "ReadResponse", which exists in base class, where it's required.
The change I made was to call that instead of copy-pasting.

"ReadResponse" implementation however cannot be removed from base as http client relies on that: it overrides, but calls base implementation in a case.

Copy link
Contributor

@phrocker phrocker Jan 24, 2019

Choose a reason for hiding this comment

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

Then that reliance may not be valid any longer. I think some parent class details changed, but I will have to further investigate the HTTP portion. I want to fully understand this, instead of going off of memory. If it is a bug that can be a follow on, but once I take a closer look at HTTP it may become obvious. What the parent currently does, is an invalid reliance from the end of HTTP, but since things changed in some of the accessory code it may never get there, meaning we can make it pure virtual; however, I'll take a closer look at it while running to validate that it's not a bug before going that route.

Copy link
Contributor

@phrocker phrocker Jan 24, 2019

Choose a reason for hiding this comment

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

I'll also take another look at this PR closely and approve for merge in 0.7.0 if it doesn't change status quo for http ( which it doesn't look like it does at a quick glance ).

By the way, what scope of testing have you performed on this code via docker or in a deployed environment? I understand it's "moving code," but mistakes happen. Don't want to duplicate that effort.

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't see a response for this. I have some time in the next few days to run tests. What have you been able to run? Thanks!

Copy link
Contributor Author

@arpadboda arpadboda Jan 31, 2019

Choose a reason for hiding this comment

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

Two things I did:
-Executed site2site related unit tests
-Verified transfers from MiNiFi to NiFi using the C examples (which still rely on C++ S2S implementation atm)

Any further verification is welcome and thanks in advance for that!

Copy link
Contributor

@phrocker phrocker Jan 31, 2019

Choose a reason for hiding this comment

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

Yep, I usually do full scope when anything touches core code, no matter how trivial the changes appear: docker tests, site to site secure, unsecure, transfers -- in this case I'll do raw and http just to be safe ( in minifi note C agent )...maybe more if I think it's prudent -- once all that is done I'll take another look at the PR and approve for merge in 0.7.0. Thanks.

@phrocker
Copy link
Contributor

@arpadboda can you force travis and appveyor to re-run on this so that we can do a little more eval and before merging this?

@arpadboda
Copy link
Contributor Author

@arpadboda can you force travis and appveyor to re-run on this so that we can do a little more eval and before merging this?

Sure, rebased to master, pushed.

@asfgit asfgit closed this in 7514caa Apr 11, 2019
nghiaxlee pushed a commit to nghiaxlee/nifi-minifi-cpp that referenced this pull request Jul 8, 2019
This closes apache#470.

Signed-off-by: Marc Parisi <phrocker@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants