You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by pvillard31 <gi...@git.apache.org> on 2017/09/01 09:17:12 UTC

[GitHub] nifi pull request #2119: NIFI-4341 - add provenance repository storage usage...

GitHub user pvillard31 opened a pull request:

    https://github.com/apache/nifi/pull/2119

    NIFI-4341 - add provenance repository storage usage in UI

    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:
    - [ ] 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 master)?
    
    - [ ] Is your initial contribution a single, squashed commit?
    
    ### 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?
    - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] 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.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pvillard31/nifi NIFI-4341

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/2119.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2119
    
----
commit f8a7b8d919a3336cf7bc581e1aeee8097bb2f195
Author: Pierre Villard <pi...@gmail.com>
Date:   2017-09-01T09:16:29Z

    NIFI-4341 - add provenance repository storage usage in UI

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #2119: NIFI-4341 - add provenance repository storage usage in UI

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on the issue:

    https://github.com/apache/nifi/pull/2119
  
    Thanks @pvillard31! This has been merged to master.


---

[GitHub] nifi pull request #2119: NIFI-4341 - add provenance repository storage usage...

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2119#discussion_r137875951
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java ---
    @@ -404,24 +404,13 @@ public FileVisitResult visitFile(final Path file, final BasicFileAttributes attr
         @Override
         public long getContainerCapacity(final String containerName) throws IOException {
             final Path path = containers.get(containerName);
    -        if (path == null) {
    --- End diff --
    
    This null check ensure's this repository has the specified container. This check was moved to the utility method in `FileUtils`. I'm not sure there is a condition where the containerName is unrecognized but this is general defensive programming. No issue here, just referencing it for other comments.


---

[GitHub] nifi pull request #2119: NIFI-4341 - add provenance repository storage usage...

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2119#discussion_r137876726
  
    --- Diff: nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java ---
    @@ -521,6 +522,23 @@ public RepositoryConfiguration getConfiguration() {
             return configuration;
         }
     
    +    @Override
    +    public Set<String> getContainerNames() {
    +        return new HashSet<>(configuration.getStorageDirectories().keySet());
    +    }
    +
    +    @Override
    +    public long getContainerCapacity(final String containerName) throws IOException {
    +        final Path path = configuration.getStorageDirectories().get(containerName).toPath();
    --- End diff --
    
    `FileUtils.getContainerCapacity` verifies the containerName is non null. However, if the specified container is unknown to this repository it will fail here prior to invoking the `FileUtils`. This issue exists in a number of places in this PR.


---

[GitHub] nifi pull request #2119: NIFI-4341 - add provenance repository storage usage...

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2119#discussion_r137878394
  
    --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsSnapshotDTO.java ---
    @@ -361,6 +371,12 @@ public SystemDiagnosticsSnapshotDTO clone() {
                 contentRepoStorageUsage.add(usage.clone());
             }
     
    +        final Set<StorageUsageDTO> provenanceRepoStorageUsage = new LinkedHashSet<>();
    --- End diff --
    
    Can we add a null checks around these parts of the `clone` method?
    
    `if (getContentRepositoryStorageUsage() != null) {`
    `if (getProvenanceRepositoryStorageUsage() != null) {`
    `if (getGarbageCollection() != null) {`
    
    I realize that a couple of these weren't part of your PR but could lead to an NPE if the DTO isn't fully populated at time of invocation.


---

[GitHub] nifi issue #2119: NIFI-4341 - add provenance repository storage usage in UI

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on the issue:

    https://github.com/apache/nifi/pull/2119
  
    Will review...


---

[GitHub] nifi pull request #2119: NIFI-4341 - add provenance repository storage usage...

Posted by mcgilman <gi...@git.apache.org>.
Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2119#discussion_r137877545
  
    --- Diff: nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java ---
    @@ -592,4 +592,41 @@ public static boolean isSame(final File file1, final File file2) throws IOExcept
             return digest.digest();
         }
     
    +    /**
    +     * Returns the capacity for a given path associated to a container name
    +     * @param containerName container name
    +     * @param path path
    +     * @return total space
    +     * @throws IOException in case there is no space
    +     */
    +    public static long getContainerCapacity(final String containerName, final Path path) throws IOException {
    +        if (path == null) {
    --- End diff --
    
    Based on the other comments I've left, it may make sense to remove these checks from the utility method and instead perform the checks from where these methods are invoked. Since in some instances, we have a `Path` already and other instances we have a `File`. Not sure... just offering it as a possibility.


---

[GitHub] nifi issue #2119: NIFI-4341 - add provenance repository storage usage in UI

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on the issue:

    https://github.com/apache/nifi/pull/2119
  
    Thanks for the review @mcgilman. I just pushed another commit to address your comments. Let me know if something is wrong.


---

[GitHub] nifi pull request #2119: NIFI-4341 - add provenance repository storage usage...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/nifi/pull/2119


---