[ 
https://issues.apache.org/jira/browse/NIFI-11595?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Peter Turcsanyi updated NIFI-11595:
-----------------------------------
    Description: 
{{StateProvider.replace()}} method properly works when the state already exists 
and persisted in the storage. However, it cannot create the state at first run.
As a workaround, {{setState()}} needs to be used but it does not provide the 
same compare-and-swap mechanism as {{replace()}} so it is the caller 
responsibility to handle concurrency.
To lift this responsibility from the clients and also to provide a more 
consistent API, {{replace()}} should support creating the initial state. It 
should be able to move the state "from nothing to X" not only "from X1 to X2" 
and also providing the same compare-and-swap logic.

Affected {{StateProvider}} implementations:
- {{ZooKeeperStateProvider}}
- {{RedisStateProvider}}
- {{KubernetesConfigMapStateProvider}}
- {{WriteAheadLocalStateProvider}}


  was:ZooKeeperStateProvider.replace() method properly works when the state 
already exists and persisted in Zookeeper. However, it cannot create the state 
(ZK node) at first run.


> StateProvider.replace() cannot create the initial state
> -------------------------------------------------------
>
>                 Key: NIFI-11595
>                 URL: https://issues.apache.org/jira/browse/NIFI-11595
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>            Reporter: Peter Turcsanyi
>            Assignee: Peter Turcsanyi
>            Priority: Major
>
> {{StateProvider.replace()}} method properly works when the state already 
> exists and persisted in the storage. However, it cannot create the state at 
> first run.
> As a workaround, {{setState()}} needs to be used but it does not provide the 
> same compare-and-swap mechanism as {{replace()}} so it is the caller 
> responsibility to handle concurrency.
> To lift this responsibility from the clients and also to provide a more 
> consistent API, {{replace()}} should support creating the initial state. It 
> should be able to move the state "from nothing to X" not only "from X1 to X2" 
> and also providing the same compare-and-swap logic.
> Affected {{StateProvider}} implementations:
> - {{ZooKeeperStateProvider}}
> - {{RedisStateProvider}}
> - {{KubernetesConfigMapStateProvider}}
> - {{WriteAheadLocalStateProvider}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to