Mark Payne created NIFI-2149:
--------------------------------

             Summary: When saving flow, NiFi should allow the flow to 
automatically be backed up
                 Key: NIFI-2149
                 URL: https://issues.apache.org/jira/browse/NIFI-2149
             Project: Apache NiFi
          Issue Type: Improvement
          Components: Configuration, Core Framework, Documentation & Website
            Reporter: Mark Payne
             Fix For: 1.0.0


Each time that a user updates the NiFi flow, the new flow is written to the 
flow.xml.gz on each node. When this occurs, we should provide the option of 
also writing the flow.xml.gz to an 'archive' folder, using a filename based on 
the current time. We should also ensure that we keep old flows for X 
(configurable) amount of time and only use a max of some configurable amount of 
disk space.

StandardXMLFlowConfigurationDAO (in nifi-framework-core) already has a method 
for `save(FlowController controller, boolean archive)` but 'false' is always 
passed as the 'archive' field. We should instead pass in `true` if configured 
to archive.

Additionally, we should change the archive filename so that it is based on a 
user-readable date/time, such as flow-2016-06-29-11-10-50am.xml.gz, for 
instance, for a flow that was saved at 11:10:50 AM on June 29, 2016. This 
allows an admin to easily revert a flow back to how it was at some point in 
history.

Changes required to implement this include: 

1. Update nifi.properties to include new properties (with the suggested 
defaults that may need to be adjusted):
- nifi.flow.configuration.archive.enabled=true
- nifi.flow.configuration.archive.max.time=30 days
- nifi.flow.configuration.archive.max.storage=500 MB

There already is a property named `nifi.flow.configuration.archive.dir` that 
should be used to specify where to save the archived flow. This is used 
currently only when the user clicks the 'archive' button in the UI.

2. Update StandardFlowService.saveFlowChanges(TimeUnit delayUnit, long delay) 
so that it passes a value of `true` for the 'archive' flag when calling the 
overridden saveFlowChanges method in the case that the 
`nifi.flow.configuration.archive.enabled` property is set to true (default).

3. Update StandardXMLFlowConfigurationDAO.createArchiveFile() to use a more 
user-friendly filename, as described above.

4. Update StandardXMLFlowConfigurationDAO.save() so that the `if (archive) {` 
branch first cleans up old/expired flows so that the `archive` directory is 
smaller than the configured max storage space and so that any archived flow 
that is older than the configured `nifi.flow.configuration.archive.max.time` 
property is removed.

5. Update Admin Guide to explain the new properties




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to