apache-nifiapache-nifi-registry

Cannot delete a flow in Nifi registry via http call when using git as storage


When using DELETE /buckets/{bucketId}/flows/{flowId},

it cannot delete a flow which has version 0.

for example, something like the following flow cannot be deleted via the above http call.

{
    "bucketIdentifier": "6a0f624c-3163-496e-bb60-9ca4fe287654",
    "bucketName": "flow_bucket",
    "createdTimestamp": 1550243254914,
    "description": "A Versioned Flow from pyApi",
    "identifier": "d3738331-78b3-4dda-ab6b-a2975db762ff",
    "link": {
        "href": "buckets/6a0f624c-3163-496e-bb60-9ca4fe287654/flows/d3738331-78b3-4dda-ab6b-a2975db762ff",
        "params": {
            "rel": "self"
        }
    },
    "modifiedTimestamp": 1550243254914,
    "name": "test flow by pyApi",
    "permissions": {
        "canDelete": true,
        "canRead": true,
        "canWrite": true
    },
    "type": "Flow",
    "versionCount": 0
}

Is there any other way to delete such flow? This flow is created by nipyapi.versioning.save_flow_ver() given a different flow_name. Although it fails with 409, it still creates a flow in Nifi registry. The storage is git(gitlab specifically)


Solution

  • I agree with Ben it is likely you are encountering a bug and not intended behavior. In addition to the suggestion to manually edit the H2 metadata database, you could also try adding a flow snapshot version (the versioned flow could be anything), to get version 1 saved for this flow, and then deleting the entire flow. That is:

    POST /buckets/6a0f624c-3163-496e-bb60-9ca4fe287654/flows/d3738331-78b3-4dda-ab6b-a2975db762ff/versions/
    DELETE /buckets/6a0f624c-3163-496e-bb60-9ca4fe287654/flows/d3738331-78b3-4dda-ab6b-a2975db762ff
    

    I will open an Apache Jira issue to track fixing this bug.