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

ASF GitHub Bot commented on KAFKA-5606:
---------------------------------------

GitHub user jedichien opened a pull request:

    https://github.com/apache/kafka/pull/3667

    [KAFKA-5606] Review consumer's RequestFuture usage pattern

    Replacing succeeded, failed and retry with a status method returning an 
enum with 'SUCCEEDED', 'FAILED', 'RETRY' and 'NOT_RETRY'

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jedichien/kafka KAFKA-5606

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/3667.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3667
    
----
commit da4bcbaa90ed2107128914f7d6ca92add6e616db
Author: jameschien <jamesch...@staff.ruten.com.tw>
Date:   2017-04-27T08:00:20Z

    change connection refused message from level DEBUG into WARN.

commit 1adfd44424f2760def0a648c96129243088ef044
Author: jameschien <jamesch...@staff.ruten.com.tw>
Date:   2017-05-02T08:26:04Z

    replace KeyValuePrinter and KStreamForeach with KStreamPeek

commit 407b48b83d3acd8e7803bd32e93aa28e48c446a9
Author: jameschien <jamesch...@staff.ruten.com.tw>
Date:   2017-05-02T10:45:23Z

    replace KeyValuePrinter and KStreamForeach with KStreamPeek

commit 9c3caa19724606e2e8982ea1c63ce8a480945e73
Author: jameschien <jamesch...@staff.ruten.com.tw>
Date:   2017-05-02T10:51:01Z

    revert

commit 80dc9358962c85bf7d369dea5fa5e41965071585
Author: JamesChien <jedich...@users.noreply.github.com>
Date:   2017-05-03T01:20:56Z

    remove unused variable

commit 0777963ffc452e69eb468e546c7e4881ecff4cde
Author: jameschien <jamesch...@staff.ruten.com.tw>
Date:   2017-05-05T09:01:46Z

    replace 'KStreamPeek#KStreamPeekProcessor' with PrintForeachAction

commit 65eddb227ddc003e71e1e79a2d378014d652566c
Author: jameschien <jamesch...@staff.ruten.com.tw>
Date:   2017-05-05T09:03:59Z

    revert and will open new issue to discuss whether to keep this or not

commit 08f37fb99e16c701f293d59d9d12a8f039e9613e
Author: jameschien <jamesch...@staff.ruten.com.tw>
Date:   2017-05-05T09:05:00Z

    Merge branch 'trunk' of https://github.com/jedichien/kafka into trunk
    
    replace 'KStreamPeek#KStreamPeekProcessor' with PrintForeachAction

commit 3371b13aec71d80e097212820b0beef625948f37
Author: jameschien <jamesch...@staff.ruten.com.tw>
Date:   2017-05-08T10:07:04Z

    add final and remove unnecessary code

commit bfbcced3969701e525d61099999372ff6cbedbd4
Author: jameschien <jamesch...@staff.ruten.com.tw>
Date:   2017-05-08T10:13:50Z

    add final to local variable

commit 62972990a84c4a77c7ca8c3eba6028ddb3f73990
Author: jameschien <jamesch...@staff.ruten.com.tw>
Date:   2017-05-17T01:34:34Z

    add KStreamPrint to print data message with PrintForeachAction

commit 57784600657c71ed4736704bf07af8060e79b74f
Author: jameschien <jamesch...@staff.ruten.com.tw>
Date:   2017-05-17T01:45:09Z

    add KStreamPrint to print data message with PrintForeachAction

commit 83101ff29ffe52735883e8b71f61176388724229
Author: JamesChien <jedich...@users.noreply.github.com>
Date:   2017-05-18T09:14:08Z

    Augment KStream.print() to allow users pass in extra parameters in the 
printed string. I extend print() to KStream.print(KeyValueMapper<K, V, 
String>), KStream.print(KeyValueMapper<K, V, String>, String streamName), 
KStream.print(KeyValueMapper<K, V, String>, Serde<K>, Serde<V>) and 
KStream.print(KeyValueMapper<K, V, String>, Serde<K>, Serde<V>, String 
streamName).

commit c40db4fa6e0d0bc99e339f1f5749ee73e83a2ec8
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-05-23T02:17:51Z

    fix conflict

commit e72a6c6fabd4c2139155a8927f7d2bc851914479
Author: JamesChien <james.chain1...@gmail.com>
Date:   2017-05-23T02:28:21Z

    Merge branch 'trunk' into KAFKA-4830

commit 3fe6a8ba513287755df7fc51a1d7b1e59aba0a23
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-05-23T02:29:53Z

    remove whitespace

commit 28c8ccdb18757e7a832d3fe83e53b45e049bf6f9
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-05-23T02:38:19Z

    I forget to remove this code when I solve confliction

commit 03a3f906d6eba9ded70af4fcd21638346822fc7b
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-05-23T02:41:14Z

    I forget to remove this code when I solve confliction

commit b858b0ff52a4881a5f5146430122219f61bfefb3
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-06-23T04:21:17Z

    [KIP-160] Augment KStream.print() and KStream.writeAsText() to allow users 
pass in extra parameters in the printed string.

commit 5245ed9e79e32138cda5f198b644a333e113715c
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-06-23T04:22:33Z

    Merge remote-tracking branch 'origin/KAFKA-4830' into KAFKA-4830

commit ce8d16ed650d3649cf20763021f4983f699365fc
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-07-17T06:38:01Z

    [KIP-160] Augment KStream.print() and KStream.writeAsText() to allow users 
pass in extra parameters in the printed string.

commit b7c14115c384d8f8388d903968ee9bdc4395fc57
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-07-18T02:55:02Z

    [KIP-160] Augment KStream.print() and KStream.writeAsText() to allow users 
pass in extra parameters in the printed string.

commit de352f665d15a02102275bcb018152e59bf8a465
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-07-18T09:11:38Z

    [KIP-160] Augment KStream.print() and KStream.writeAsText() to allow users 
pass in extra parameters in the printed string.

commit b2c8e0030d1be0c1ce647e59f6545c87659e3f47
Author: jameschien <jamesch...@staff.ruten.com.tw>
Date:   2017-04-27T08:00:20Z

    change connection refused message from level DEBUG into WARN.

commit 0a10b8078b8f24dee814c01ac1a5188d9346e605
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-07-24T04:51:14Z

    rebase

commit 089f2e292c8ceee54d354bae9d61258401350fa4
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-07-24T04:53:32Z

    rebase

commit 63f53b68d2e8f389f1409d13e452565310cd37a1
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-08-02T06:53:03Z

    rebase

commit a91bc7b15b63dbf20c25b629a58b3058a6228b2d
Author: jedichien <james.chain1...@gmail.com>
Date:   2017-08-15T02:41:58Z

    [KAFKA-5606] replacing succeeded, failed and retry with a status method 
returning an enum with 'SUCCEEDED', 'FAILED', 'RETRY', and 'NOT_RETRY'

----


> Review consumer's RequestFuture usage pattern
> ---------------------------------------------
>
>                 Key: KAFKA-5606
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5606
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Ismael Juma
>            Assignee: james chien
>             Fix For: 1.0.0
>
>
> KAFKA-5556 shows that we can perhaps tighten the usage pattern of the 
> consumer's RequestFuture to avoid similar bugs in the future.
> Jason suggested:
> {quote}
> Another way to see this bug is a failure to ensure completion of the future. 
> Had we done so, then we could have skipped the failed check. This is why it 
> worked prior to the patch which added the timeout. The pattern should really 
> be something like this:
> {code}
> if (future.isDone()) {
>   if (future.succeeded()) {
>     // handle success
>   } else {
>     // handle failure
>   }
> }
> {code}
> I guess one benefit of the enum approach is that it forces you to ensure 
> completion prior to checking any of the possible results. That said, I'm a 
> bit more inclined to remove the isRetriable method and leave it to the caller 
> to determine what is and is not retriable. Then the request future only has 
> two completion states.
> {quote}
> An alternative is replacing succeeded and failed with a status method 
> returning an enum with 3 states: SUCCEEDED, FAILED, RETRY (the enum approach 
> mentioned above). This would make sense if we often have to handle these 3 
> states differently.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to