Github user JPercivall commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/642#discussion_r71347101
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListDatabaseTables.java
 ---
    @@ -260,8 +241,27 @@ public void onTrigger(ProcessContext context, 
ProcessSession session) throws Pro
                             .filter(segment -> !StringUtils.isEmpty(segment))
                             .collect(Collectors.joining("."));
     
    -                String fqTableName = stateMapProperties.get(fqn);
    -                if (fqTableName == null) {
    +                String lastTimestampForTable = stateMapProperties.get(fqn);
    +                boolean refreshTable = true;
    +                try {
    +                    // Refresh state if the interval has elapsed
    +                    long lastRefreshed = -1;
    +                    final long currentTime = System.currentTimeMillis();
    +                    if (!StringUtils.isEmpty(lastTimestampForTable)) {
    +                        lastRefreshed = 
Long.parseLong(lastTimestampForTable);
    +                    }
    +                    if (lastRefreshed == -1 || (refreshInterval > 0 && 
currentTime >= (lastRefreshed + refreshInterval))) {
    +                        stateMapProperties.remove(lastTimestampForTable);
    +                    } else {
    +                        refreshTable = false;
    +                    }
    +                } catch (final NumberFormatException nfe) {
    +                    getLogger().error("Failed to retrieve observed last 
table fetches from the State Manager. Will not perform "
    --- End diff --
    
    This exception really *shouldn't* happen since we are setting the long 
ourselves but if it does it will fail entirely until state is cleared by the 
user. In addition to returning and yielding, it should probably clear the 
offending state entry (and log in the error message that this is hapenning and 
the ramifications). This will at least give the processor a chance to continue 
working if it every reaches this state. 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to