Hi NiFi devs,
I have a question about the design of the Copy/Paste endpoints added in
NIFI-13976 (2.1.0, PR #9535).
Observation
There are three ways to add existing flow content to a Process Group:
1. Snippet: POST /snippets, then POST
/process-groups/{id}/snippet-instance
2. Copy/Paste: POST /process-groups/{id}/copy, then PUT
/process-groups/{id}/paste
3. Snapshot import: GET /process-groups/{id}/download, then POST
/process-groups/{id}/process-groups with a versionedFlowSnapshot in the
request body
Only Paste requires the target group's revision. A stale revision returns a
409:
[0, null, <groupId>] is not the most up-to-date revision. This component
> appears to have been modified.
Snippet instantiation takes no revision for the parent. In the snapshot
import, the revision in the request body (version: 0) belongs to the newly
created group, not the parent. In both cases, the parent group's revision
is unchanged afterwards. I checked this on NiFi 2.5.0 by reading the parent
group's revision after each operation. Only Paste changed it (version: 0 →
1).
Here are my questions:
1. Is requiring the parent revision for Paste an intentional concurrency
guard, for example, because Paste goes through the VersionedComponent
synchronizer like updateProcessGroupContents? Or did it follow the
convention that "the revision is required for any mutable flow requests"?
2. Snippet instantiation and snapshot import add comparable content
without a parent revision. Is that difference deliberate? If so, what does
the parent revision protect in the Paste case that it does not in the
others?
3. For non-UI clients, is the expected behavior on 409 to re-read the
group revision and retry the whole Paste?
4. Is it known that Paste is not atomic? From reading the code, an
exception thrown after the revision check does not roll back components
that were already added.
I searched JIRA (NIFI-13975, NIFI-13976, NIFI-13977) and the dev list
archive but did not find a discussion of this. Thanks for your help in
advance.
Regards,
Xinyu