You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bookkeeper.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/05/11 17:27:04 UTC

[jira] [Commented] (BOOKKEEPER-1065) OrderedSafeExecutor should only have 1 thread per bucket

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

ASF GitHub Bot commented on BOOKKEEPER-1065:
--------------------------------------------

GitHub user merlimat opened a pull request:

    https://github.com/apache/bookkeeper/pull/152

    BOOKKEEPER-1065: OrderedSafeExecutor should only have 1 thread per bucket

    

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

    $ git pull https://github.com/merlimat/bookkeeper bk-1065-ordering

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

    https://github.com/apache/bookkeeper/pull/152.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 #152
    
----
commit 56935880f4c1e40c7f4cd666df4ba3bf027afdb7
Author: Matteo Merli <mm...@apache.org>
Date:   2017-05-11T17:06:55Z

    BOOKKEEPER-1065: OrderedSafeExecutor should only have 1 thread per bucket

----


> OrderedSafeExecutor should only have 1 thread per bucket
> --------------------------------------------------------
>
>                 Key: BOOKKEEPER-1065
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-1065
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Matteo Merli
>            Assignee: Matteo Merli
>             Fix For: 4.5.0
>
>
> In a earlier commit, "BOOKKEEPER-874: Explict LAC from Writer to Bookie", there was this change in the OrderedSafeExecutor implementation: 
> {noformat}
>          for (int i = 0; i < numThreads; i++) {
> -            queues[i] = new LinkedBlockingQueue<Runnable>();
> -            threads[i] =  new ThreadPoolExecutor(1, 1,
> -                    0L, TimeUnit.MILLISECONDS, queues[i],
> +            threads[i] =  new ScheduledThreadPoolExecutor(1,
>                      new ThreadFactoryBuilder()
>                          .setNameFormat(name + "-orderedsafeexecutor-" + i + "-%d")
>                          .setThreadFactory(threadFactory)
>                          .build());
> +            threads[i].setMaximumPoolSize(1);
> {noformat}
> Then, as part of "BOOKKEEPER-1013: Fix findbugs errors on latest master", the max pool size line has been removed.
> {noformat}
> @@ -183,7 +183,6 @@ public class OrderedSafeExecutor {
>                          .setNameFormat(name + "-orderedsafeexecutor-" + i + "-%d")
>                          .setThreadFactory(threadFactory)
>                          .build());
> -            threads[i].setMaximumPoolSize(1);
>              // Save thread ids
>              final int idx = i;
> {noformat}
> Without that the thread pool would create multiple threads for the same bucket, breaking the ordering guarantee of the executor.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)