[ https://issues.apache.org/jira/browse/NIFI-11595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17766890#comment-17766890 ]
ASF subversion and git services commented on NIFI-11595: -------------------------------------------------------- Commit ac80b9d900221fedb59142e4a4802bf4ab2a17f4 in nifi's branch refs/heads/main from Peter Turcsanyi [ https://gitbox.apache.org/repos/asf?p=nifi.git;h=ac80b9d900 ] NIFI-11595 StateProvider.replace() supports creating the initial state - Extracted common logic from setState() and replace() into modifyState() - Removed redundant code from createNode() because exceptions are handled on the caller side - NodeExistsException and InterruptedException are handled in setState() and replace() - Also used KeeperException's subclasses instead of KeeperException.code() This closes #7324 Signed-off-by: David Handermann <exceptionfact...@apache.org> > 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 > Fix For: 1.latest, 2.latest > > Time Spent: 10m > Remaining Estimate: 0h > > {{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)