[jira] [Commented] (KAFKA-10410) OnRestoreStart disappeared from StateRestoreCallback in 2.6.0 and reappeared in a useless place

2020-08-27 Thread Mark Shelton (Jira)


[ 
https://issues.apache.org/jira/browse/KAFKA-10410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17186092#comment-17186092
 ] 

Mark Shelton commented on KAFKA-10410:
--

Yes using a Singleton would work, like I said in my first comment. But I'm not 
coding up a singleton unless I can avoid it.

The metrics of the restore operation are only available in the 
StateRestoreCallback. Since StateRestoreCallback no longer receives the 
start/end/complete notification its the same problem.

 

> OnRestoreStart disappeared from StateRestoreCallback  in 2.6.0 and reappeared 
> in a useless place
> 
>
> Key: KAFKA-10410
> URL: https://issues.apache.org/jira/browse/KAFKA-10410
> Project: Kafka
>  Issue Type: Bug
>  Components: streams
>Affects Versions: 2.6.0
>Reporter: Mark Shelton
>Priority: Blocker
>
> In version 2.5.0 and earlier there are "onRestoreStart" and "onRestoreEnd" 
> methods on StateRestoreCallback.
> Version 2.6.0 removed these calls and put them into StateRestoreListener and 
> requires "streaming.setGlobalStateRestoreListener".
> This makes it impossible for the actual StateRestoreCallback implementation 
> to receive the start and end indication and is blocking me from moving to 
> 2.6.0.
> See:
> [https://kafka.apache.org/25/javadoc/index.html?org/apache/kafka/streams/processor/AbstractNotifyingRestoreCallback.html]
>  
> Related JIRA:
> https://issues.apache.org/jira/browse/KAFKA-4322 



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


[jira] [Commented] (KAFKA-10410) OnRestoreStart disappeared from StateRestoreCallback in 2.6.0 and reappeared in a useless place

2020-08-27 Thread Guozhang Wang (Jira)


[ 
https://issues.apache.org/jira/browse/KAFKA-10410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17186019#comment-17186019
 ] 

Guozhang Wang commented on KAFKA-10410:
---

Thanks Mark for your explanation. I think for metrics recording since the 
callbacks contain the partition / store-name information it can be done 
independently from the callback. For transaction / cleanup, it depends on your 
specific scenarios, but if it has to couple with the callbacks one way like 
Sophie mentioned is to let the global listener keeps reference of each callback 
that ever gets created / registered --- admittedly it is a bit awkward, but it 
should work around it.

> OnRestoreStart disappeared from StateRestoreCallback  in 2.6.0 and reappeared 
> in a useless place
> 
>
> Key: KAFKA-10410
> URL: https://issues.apache.org/jira/browse/KAFKA-10410
> Project: Kafka
>  Issue Type: Bug
>  Components: streams
>Affects Versions: 2.6.0
>Reporter: Mark Shelton
>Priority: Blocker
>
> In version 2.5.0 and earlier there are "onRestoreStart" and "onRestoreEnd" 
> methods on StateRestoreCallback.
> Version 2.6.0 removed these calls and put them into StateRestoreListener and 
> requires "streaming.setGlobalStateRestoreListener".
> This makes it impossible for the actual StateRestoreCallback implementation 
> to receive the start and end indication and is blocking me from moving to 
> 2.6.0.
> See:
> [https://kafka.apache.org/25/javadoc/index.html?org/apache/kafka/streams/processor/AbstractNotifyingRestoreCallback.html]
>  
> Related JIRA:
> https://issues.apache.org/jira/browse/KAFKA-4322 



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


[jira] [Commented] (KAFKA-10410) OnRestoreStart disappeared from StateRestoreCallback in 2.6.0 and reappeared in a useless place

2020-08-26 Thread Sophie Blee-Goldman (Jira)


[ 
https://issues.apache.org/jira/browse/KAFKA-10410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17185511#comment-17185511
 ] 

Sophie Blee-Goldman commented on KAFKA-10410:
-

It's hard to say without knowing specifically what happens in your 
StateRestoreCallback, but handling transactions with the StateRestoreListener  
sounds potentially unsafe: even before 2.6, `onRestoreEnd` was never guaranteed 
to be called when a store stopped restoring, only when the restoration actually 
completed (onRestoreComplete would have been a better name). So it was always 
possible for onRestoreStart to be called without ever calling onRestoreEnd, or 
for onRestoreStart to be called multiple times in a row, etc

That said, can't you just register the callback of each store+partition to your 
global restore listener, then use the handle on the callback to do whatever 
cleanup you needed for that particular store when onRestoreEnd is called for 
it? It's certainly a bit roundabout, but definitely still possible

> OnRestoreStart disappeared from StateRestoreCallback  in 2.6.0 and reappeared 
> in a useless place
> 
>
> Key: KAFKA-10410
> URL: https://issues.apache.org/jira/browse/KAFKA-10410
> Project: Kafka
>  Issue Type: Bug
>  Components: streams
>Affects Versions: 2.6.0
>Reporter: Mark Shelton
>Priority: Blocker
>
> In version 2.5.0 and earlier there are "onRestoreStart" and "onRestoreEnd" 
> methods on StateRestoreCallback.
> Version 2.6.0 removed these calls and put them into StateRestoreListener and 
> requires "streaming.setGlobalStateRestoreListener".
> This makes it impossible for the actual StateRestoreCallback implementation 
> to receive the start and end indication and is blocking me from moving to 
> 2.6.0.
> See:
> [https://kafka.apache.org/25/javadoc/index.html?org/apache/kafka/streams/processor/AbstractNotifyingRestoreCallback.html]
>  
> Related JIRA:
> https://issues.apache.org/jira/browse/KAFKA-4322 



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


[jira] [Commented] (KAFKA-10410) OnRestoreStart disappeared from StateRestoreCallback in 2.6.0 and reappeared in a useless place

2020-08-26 Thread Mark Shelton (Jira)


[ 
https://issues.apache.org/jira/browse/KAFKA-10410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17185481#comment-17185481
 ] 

Mark Shelton commented on KAFKA-10410:
--

My implementation of StateRestoreCallback needs to know when the state restore 
starts and when it ends. This is because it needs to handle statistics, 
transaction stuff and cleanup. In version 2.5 and earlier this was easy as the 
methods were already there on {{AbstractNotifyingRestoreCallback.}}

With version 2.6 only the "StateRestoreListener", which is per streams 
instance, receives the "onRestartStart" and "onRestartEnd". Since the 
"StateRestoreListener" is per streams instance there is no easy way for it to 
notify any StateRestoreCallback instance(s).

In version 2.5 and earlier the following was available and convenient. But 
since {{AbstractNotifyingRestoreCallback}} is removed the update to version 2.6 
is a show stopper.

{{public class MyStateRestoreCallback extends AbstractNotifyingRestoreCallback 
{}}
{{}}

{{  @Override}}
{{   public void onRestoreStart(TopicPartition topicPartition, String 
storeName, long startingOffset, long endingOffset) {}}

{{    // called by Kafka Streams}}
{{  }}}

{{  @Override}}
{{   public void onRestoreEnd(TopicPartition topicPartition, String storeName, 
long totalRestored) {}}
{{    // called by Kafka Streams}}{{}}

{{  }}}

{{...}}

{{}}}

 

> OnRestoreStart disappeared from StateRestoreCallback  in 2.6.0 and reappeared 
> in a useless place
> 
>
> Key: KAFKA-10410
> URL: https://issues.apache.org/jira/browse/KAFKA-10410
> Project: Kafka
>  Issue Type: Bug
>  Components: streams
>Affects Versions: 2.6.0
>Reporter: Mark Shelton
>Priority: Blocker
>
> In version 2.5.0 and earlier there are "onRestoreStart" and "onRestoreEnd" 
> methods on StateRestoreCallback.
> Version 2.6.0 removed these calls and put them into StateRestoreListener and 
> requires "streaming.setGlobalStateRestoreListener".
> This makes it impossible for the actual StateRestoreCallback implementation 
> to receive the start and end indication and is blocking me from moving to 
> 2.6.0.
> See:
> [https://kafka.apache.org/25/javadoc/index.html?org/apache/kafka/streams/processor/AbstractNotifyingRestoreCallback.html]
>  
> Related JIRA:
> https://issues.apache.org/jira/browse/KAFKA-4322 



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


[jira] [Commented] (KAFKA-10410) OnRestoreStart disappeared from StateRestoreCallback in 2.6.0 and reappeared in a useless place

2020-08-26 Thread Guozhang Wang (Jira)


[ 
https://issues.apache.org/jira/browse/KAFKA-10410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17185367#comment-17185367
 ] 

Guozhang Wang commented on KAFKA-10410:
---

Not sure if I fully understand what do you mean by "GlobalStateRestoreListener 
have a way of obtaining StateRestoreCallback", but just to clarify, the 
"StateRestoreListener" is used for notifying when a restoration is started / 
ended etc, and the "StateRestoreCallback" is for the actual implementation of 
applying the changelog records to the state stores, and they should naturally 
be in two separate implementations:

1) You specify the per-store "StateRestoreCallback" when you register a store.
2) You specify the global "StateRestoreListener" when you instantiate a streams 
instance.

We do not recommend having just one impl class that extends both interfaces 
moving forward.

If you can share your current code maybe that can help me better understanding 
your pattern.

> OnRestoreStart disappeared from StateRestoreCallback  in 2.6.0 and reappeared 
> in a useless place
> 
>
> Key: KAFKA-10410
> URL: https://issues.apache.org/jira/browse/KAFKA-10410
> Project: Kafka
>  Issue Type: Bug
>  Components: streams
>Affects Versions: 2.6.0
>Reporter: Mark Shelton
>Priority: Blocker
>
> In version 2.5.0 and earlier there are "onRestoreStart" and "onRestoreEnd" 
> methods on StateRestoreCallback.
> Version 2.6.0 removed these calls and put them into StateRestoreListener and 
> requires "streaming.setGlobalStateRestoreListener".
> This makes it impossible for the actual StateRestoreCallback implementation 
> to receive the start and end indication and is blocking me from moving to 
> 2.6.0.
> See:
> [https://kafka.apache.org/25/javadoc/index.html?org/apache/kafka/streams/processor/AbstractNotifyingRestoreCallback.html]
>  
> Related JIRA:
> https://issues.apache.org/jira/browse/KAFKA-4322 



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


[jira] [Commented] (KAFKA-10410) OnRestoreStart disappeared from StateRestoreCallback in 2.6.0 and reappeared in a useless place

2020-08-21 Thread Mark Shelton (Jira)


[ 
https://issues.apache.org/jira/browse/KAFKA-10410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17182163#comment-17182163
 ] 

Mark Shelton commented on KAFKA-10410:
--

The problem is that since 2.6 the StateRestoreCallback has no way of getting 
called upon  "onRestoreStart" and "onRestoreEnd". Setting a 
GlobalStateRestoreListener does not really solve it since the 
GlobalStateRestoreListener does not have a good way of obtaining the 
StateRestoreCallback. One could put a singleton in between but that seems 
excessively awkward.

> OnRestoreStart disappeared from StateRestoreCallback  in 2.6.0 and reappeared 
> in a useless place
> 
>
> Key: KAFKA-10410
> URL: https://issues.apache.org/jira/browse/KAFKA-10410
> Project: Kafka
>  Issue Type: Bug
>  Components: streams
>Affects Versions: 2.6.0
>Reporter: Mark Shelton
>Priority: Blocker
>
> In version 2.5.0 and earlier there are "onRestoreStart" and "onRestoreEnd" 
> methods on StateRestoreCallback.
> Version 2.6.0 removed these calls and put them into StateRestoreListener and 
> requires "streaming.setGlobalStateRestoreListener".
> This makes it impossible for the actual StateRestoreCallback implementation 
> to receive the start and end indication and is blocking me from moving to 
> 2.6.0.
> See:
> [https://kafka.apache.org/25/javadoc/index.html?org/apache/kafka/streams/processor/AbstractNotifyingRestoreCallback.html]
>  
> Related JIRA:
> https://issues.apache.org/jira/browse/KAFKA-4322 



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


[jira] [Commented] (KAFKA-10410) OnRestoreStart disappeared from StateRestoreCallback in 2.6.0 and reappeared in a useless place

2020-08-19 Thread Guozhang Wang (Jira)


[ 
https://issues.apache.org/jira/browse/KAFKA-10410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17180811#comment-17180811
 ] 

Guozhang Wang commented on KAFKA-10410:
---

Hello [~markshelton], thanks for reporting this.

Yes this is a by-design fix to decouple the stateRestoreCallback (which is used 
for just applying records read from changelogs to state stores, per store) from 
stateRestoreListener (used for indicating the beginning / end / etc during 
restoration, global) since originally they was merged in a hacky way to just 
enable certain rocksDB optimization which turns out to have other side effects.

Could you let me know why you cannot set the state restore listener through 
`KafkaStreams#setGlobalStateRestoreListener`? Maybe I can try to figure out 
something to unblock you.

> OnRestoreStart disappeared from StateRestoreCallback  in 2.6.0 and reappeared 
> in a useless place
> 
>
> Key: KAFKA-10410
> URL: https://issues.apache.org/jira/browse/KAFKA-10410
> Project: Kafka
>  Issue Type: Bug
>  Components: streams
>Affects Versions: 2.6.0
>Reporter: Mark Shelton
>Priority: Blocker
>
> In version 2.5.0 and earlier there are "onRestoreStart" and "onRestoreEnd" 
> methods on StateRestoreCallback.
> Version 2.6.0 removed these calls and put them into StateRestoreListener and 
> requires "streaming.setGlobalStateRestoreListener".
> This makes it impossible for the actual StateRestoreCallback implementation 
> to receive the start and end indication and is blocking me from moving to 
> 2.6.0.
> See:
> [https://kafka.apache.org/25/javadoc/index.html?org/apache/kafka/streams/processor/AbstractNotifyingRestoreCallback.html]
>  
> Related JIRA:
> https://issues.apache.org/jira/browse/KAFKA-4322 



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