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-9289: On startup, when enabling a Controller Service & its depen… #5449

Closed
wants to merge 1 commit into from

Conversation

markap14
Copy link
Contributor

@markap14 markap14 commented Oct 7, 2021

…dencies, do not wait for the dependencies to fully enable. Doing so can take 30 seconds per each Controller Service (and per each reference). Due to some previous refactoring, this waiting period is no longer necessary, as the referencing service can now be enabled and will asynchronously complete the enabling once it becomes valid (due to the referenced service becoming enabled).

Thank you for submitting a contribution to Apache NiFi.

Please provide a short description of the PR here:

Description of PR

Enables X functionality; fixes bug NIFI-YYYY.

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 NIFI-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 main)?

  • Is your initial contribution a single, squashed commit? Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not squash or use --force when pushing to allow for clean monitoring of changes.

For code changes:

  • 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?
  • Have you verified that the full build is successful on JDK 8?
  • Have you verified that the full build is successful on JDK 11?
  • 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 GitHub Actions CI for build issues and submit an update to your PR as soon as possible.

…dencies, do not wait for the dependencies to fully enable. Doing so can take 30 seconds per each Controller Service (and per each reference). Due to some previous refactoring, this waiting period is no longer necessary, as the referencing service can now be enabled and will asynchronously complete the enabling once it becomes valid (due to the referenced service becoming enabled).
@markap14 markap14 added the hacktoberfest-accepted Hacktoberfest Accepted label Oct 11, 2021
Copy link
Contributor

@gresockj gresockj left a comment

Choose a reason for hiding this comment

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

This is a sensible improvement, and works as designed. To verify, I created a StandardRestrictedSSLContextService with a valid configuration, and an ElasticSearchClientServiceImpl that referenced it, then stopped NiFi and removed one of the property values, making it invalid. Starting up, I saw the controller services trying to enable, and then very quickly the successful server start message:

2021-10-12 07:15:39,379 DEBUG [main] o.a.n.c.s.StandardControllerServiceProvider All dependent services have been enabled for StandardControllerServiceNode[service=SSLContextService[id=74312327-017c-1000-9c2f-fede70ea26cc], name=StandardRestrictedSSLContextService, active=false]; will now start service itself
2021-10-12 07:15:39,380 INFO [main] o.a.n.c.s.StandardProcessScheduler Enabling StandardControllerServiceNode[service=SSLContextService[id=74312327-017c-1000-9c2f-fede70ea26cc], name=StandardRestrictedSSLContextService, active=false]
2021-10-12 07:15:39,380 DEBUG [main] o.a.n.c.service.ServiceStateTransition StandardControllerServiceNode[service=SSLContextService[id=74312327-017c-1000-9c2f-fede70ea26cc], name=StandardRestrictedSSLContextService, active=false] transitioned to ENABLING
2021-10-12 07:15:39,385 DEBUG [Timer-Driven Process Thread-1] o.a.n.c.s.StandardControllerServiceNode Cannot enable StandardControllerServiceNode[service=SSLContextService[id=74312327-017c-1000-9c2f-fede70ea26cc], name=StandardRestrictedSSLContextService, active=true] because it is not currently valid. (Validation State is INVALID: ['Truststore Type' validated against '' is invalid because Given value not found in allowed set 'BCFKS, PKCS12, JKS']). Will try again in 1 second

2021-10-12 07:15:42,738 INFO [main] org.apache.nifi.nar.NarAutoLoader Starting NAR Auto-Loader for directory ./extensions ...
2021-10-12 07:15:42,739 INFO [main] org.apache.nifi.web.server.JettyServer NiFi has started. The UI is available at the following URLs:
2021-10-12 07:15:42,739 INFO [main] org.apache.nifi.web.server.JettyServer https://127.0.0.1:8443/nifi
2021-10-12 07:15:42,740 INFO [main] org.apache.nifi.BootstrapListener Successfully initiated communication with Bootstrap
2021-10-12 07:15:42,740 INFO [main] org.apache.nifi.NiFi Controller initialization took 13767609072 nanoseconds ( 13  seconds).
2021-10-12 07:15:43,391 DEBUG [Timer-Driven Process Thread-8] o.a.n.c.s.StandardControllerServiceNode Cannot enable StandardControllerServiceNode[service=ElasticSearchClientServiceImpl[id=7434fd4a-017c-1000-d3ce-a6856b8fdac4], name=ElasticSearchClientServiceImpl, active=true] because it is not currently valid. (Validation State is INVALID: ['SSL Context Service' validated against '74312327-017c-1000-9c2f-fede70ea26cc' is invalid because Controller Service with ID 74312327-017c-1000-9c2f-fede70ea26cc is disabled]). Will try again in 1 second
2021-10-12 07:15:43,391 DEBUG [Timer-Driven Process Thread-7] o.a.n.c.s.StandardControllerServiceNode Cannot enable StandardControllerServiceNode[service=SSLContextService[id=74312327-017c-1000-9c2f-fede70ea26cc], name=StandardRestrictedSSLContextService, active=true] because it is not currently valid. (Validation State is INVALID: ['Truststore Type' validated against '' is invalid because Given value not found in allowed set 'BCFKS, PKCS12, JKS']). Will try again in 1 second

Notice the first enabling message was at 07:15:39 and the server startup was at 07:15:42. At this point, I was able to navigate on the UI to add the missing value, allowing the service to be enabled. Trying the same procedure on the main branch resulted in a delay of ~30 seconds before the server completed the startup process. Nice work!

@asfgit asfgit closed this in 231dd57 Oct 12, 2021
krisztina-zsihovszki pushed a commit to krisztina-zsihovszki/nifi that referenced this pull request Jun 28, 2022
…dencies, do not wait for the dependencies to fully enable. Doing so can take 30 seconds per each Controller Service (and per each reference). Due to some previous refactoring, this waiting period is no longer necessary, as the referencing service can now be enabled and will asynchronously complete the enabling once it becomes valid (due to the referenced service becoming enabled).

Signed-off-by: Joe Gresock <jgresock@gmail.com>

This closes apache#5449.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Hacktoberfest Accepted
Projects
None yet
2 participants