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

NIFI-4118 First commit of RethinkDB put processor #1942

Closed
wants to merge 8 commits into from

Conversation

mans2singh
Copy link
Contributor

@mans2singh mans2singh commented Jun 26, 2017

Thank you for submitting a contribution to Apache NiFi.

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

For all changes:

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

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

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

  • [x ] Is your initial contribution a single, squashed commit?

For code changes:

  • [x ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
  • Have you written or updated unit tests to verify your 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, including the main LICENSE file under nifi-assembly?
  • If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
  • If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?

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.

@mans2singh
Copy link
Contributor Author

The integration tests failed because RethinkDB was not available. I've disabled the integration tests.

@mans2singh
Copy link
Contributor Author

Hey Folks:

Can you please give me your feedback on this RethinkDB Put processor ?

Thanks

Mans

@jvwing
Copy link
Contributor

jvwing commented Jul 4, 2017

Reviewing

static final Relationship REL_SUCCESS = new Relationship.Builder().name("success")
.description("Sucessful FlowFiles are routed to this relationship").build();

static final Relationship REL_FAILURE = new Relationship.Builder().name("success")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be named failure?

@jvwing
Copy link
Contributor

jvwing commented Jul 4, 2017

@mans2singh, thanks for contributing this! I have a few general comments from a first pass:

  • The notice information for RethinkDB should be included in the nifi-assembly/NOTICE file.
  • The RethinkDB project styles it's name as "RethinkDB" with capitalized R, D, and B. I recommend we do the same in all of the user-visible processor naming, docs, property descriptions, etc.
  • The processor docs should include a link to the RethinkDB project.
  • Thanks for including a comprehensive test suite with solid code coverage. The integration tests also ran fine for me.

And I have a question about connection management. I don't have any experience with RethinkDB. A brief search for documentation suggests that the Java connection might be thread safe (RethinkDB Issue #1041). Is that your understanding?

@mans2singh
Copy link
Contributor Author

mans2singh commented Jul 5, 2017

Hi @jvwing -

Thanks for your comments and feedback. I've updated the code (added RethinkDB site link to the description, renamed classes to match RethinkDB conventions, updated notice files and corrected the relation) based on your review.

Regarding thread safety of the driver - as you pointed out, it is thread safe. Here is thread safety issue closed (rethinkdb/rethinkdb#5166) and the closed pull request (rethinkdb/rethinkdb#5292).

Please let me know if you have any additional observations/recommendations.

Thanks again for your thorough review.

Mans

Copy link
Contributor

@jvwing jvwing left a comment

Choose a reason for hiding this comment

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

Thanks for the update, @mans2singh. Everything is looking pretty good, I just found the one test issue and the question about strings.

} catch (Exception exception) {
getLogger().error("Failed to insert into RethinkDB due to {}",
new Object[]{exception.getLocalizedMessage()}, exception);
flowFile = session.putAttribute(flowFile, RETHINKDB_ERROR_MESSAGE, exception.getMessage() + "");
Copy link
Contributor

Choose a reason for hiding this comment

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

I notice you use the + "" method to cast objects to strings in several places. Any special reason? It does not appear too much in the NiFi codebase, as opposed to String.valueOf().

Copy link
Contributor Author

@mans2singh mans2singh Jul 9, 2017

Choose a reason for hiding this comment

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

Thanks for the suggestion - I've updated the code to use String.valueOf method.

runner.run(1,true,true);

flowFiles = runner.getFlowFilesForRelationship(PutRethinkDB.REL_FAILURE);
assertEquals(flowFiles.get(1).getAttribute(PutRethinkDB.RETHINKDB_INSERT_RESULT_DELETED_KEY), "0");
Copy link
Contributor

Choose a reason for hiding this comment

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

This integration test failed for me. I believe the failing flowfile is now at index 0, since REL_FAILURE is separate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right - it was an oversight on my part. I've corrected the test.

@mans2singh
Copy link
Contributor Author

@jvwing -

I've updated the code based on your comments. Please let me know if there is anything else required.

Thanks again.

Mans


Copyright 2010-2012 RethinkDB

Licensed under the Apache License, Version 2.0 (the "License");
Copy link
Contributor

Choose a reason for hiding this comment

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

Lines 1035-1045 should be removed. See other ASLv2 dependencies as examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the extra lines.

RethinkDB Language Drivers

Copyright 2010-2012 RethinkDB

Copy link
Contributor

Choose a reason for hiding this comment

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

lines 18-29 can be removed. Also need to add 'commons-io' in here. Can copy it from the top level NOTICE that has it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed extra lines and added commons-io as recommended.

@mans2singh
Copy link
Contributor Author

mans2singh commented Jul 9, 2017

@joewitt @jvwing -

Thanks for your review feedback and advice. I've updated the notices as you had mentioned.

Let me know if you have any other thoughts/recommendations.

Mans

@asfgit asfgit closed this in affc88e Jul 9, 2017
@jvwing
Copy link
Contributor

jvwing commented Jul 9, 2017

Thanks @mans2singh! This has been merged in.

@mans2singh
Copy link
Contributor Author

Thanks @jvwing

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