You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Bruno Cadonna (Jira)" <ji...@apache.org> on 2021/05/19 08:53:00 UTC

[jira] [Updated] (KAFKA-12812) Consider refactoring state store registration path

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

Bruno Cadonna updated KAFKA-12812:
----------------------------------
    Issue Type: Improvement  (was: Bug)

> Consider refactoring state store registration path
> --------------------------------------------------
>
>                 Key: KAFKA-12812
>                 URL: https://issues.apache.org/jira/browse/KAFKA-12812
>             Project: Kafka
>          Issue Type: Improvement
>          Components: streams
>            Reporter: Guozhang Wang
>            Priority: Major
>
> Today our state store registration call path within the stateManager (both local and global) is like this: 
> {code}
> for each store: store.init(store, context)
>    -> context.register(root, callback)
>    -> stateManager.registerStore(store, callback)
> {code}
> One can see that, we have an awkward loop from stateManager back to stateManager, and we require users to not forget calling context.register(root, callback). We do this only in order to let users pass the customized callback implementation to the stateManager.
> What about a different path like this:
> 1) We add a new interface in StateStore, like `StateRestoreCallback getCallback()` that each impl class need to provide.
> 2) We remove the `context.register(root, callback)` call; and because of that, we do not need to pass in `root` in the store.init as well.
> 3) stateManager just call `store.init(context)` (without the first parameter), and then put the store along with its restore callback into the map, without the separate `registerStore` function.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)