From issues-return-3852-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Tue Jan 8 20:03:18 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 02240180676 for ; Tue, 8 Jan 2019 20:03:17 +0100 (CET) Received: (qmail 42137 invoked by uid 500); 8 Jan 2019 19:03:17 -0000 Mailing-List: contact issues-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list issues@phoenix.apache.org Received: (qmail 42128 invoked by uid 99); 8 Jan 2019 19:03:17 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jan 2019 19:03:17 +0000 From: GitBox To: issues@phoenix.apache.org Subject: [GitHub] BinShi-SecularBird commented on a change in pull request #425: PHOENIX-5069 please go to JIRA to see the detailed design document attached. Message-ID: <154697419661.15932.8090809615664543082.gitbox@gitbox.apache.org> Date: Tue, 08 Jan 2019 19:03:16 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit BinShi-SecularBird commented on a change in pull request #425: PHOENIX-5069 please go to JIRA to see the detailed design document attached. URL: https://github.com/apache/phoenix/pull/425#discussion_r246114544 ########## File path: phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java ########## @@ -59,22 +59,36 @@ private final ConnectionQueryServices queryServices; private final LoadingCache cache; + private final ExecutorService executor; public GuidePostsCache(ConnectionQueryServices queryServices, Configuration config) { this.queryServices = Objects.requireNonNull(queryServices); + + // The size of the thread pool used for refreshing cached table stats + final int statsCacheThreadPoolSize = config.getInt( + QueryServices.STATS_CACHE_THREAD_POOL_SIZE, + QueryServicesOptions.DEFAULT_STATS_CACHE_THREAD_POOL_SIZE); + + executor = Executors.newFixedThreadPool(statsCacheThreadPoolSize); Review comment: OK, I changed to initialize thread pool only if stats are enabled. To the question "do we know why do we build the cache even when stats are disabled?", my thought is that this is fastest and simplest way to fix it, although it isn't the most efficient way. Fixing in this way still provides the uniform interface to the callers of the GuidePostCache so the calls don't need to something like "if stats are enabled then call this; otherwise call that". One of efficient and formal ways to fix it is that we define the interface of GuidePostsCache, two classes implement the interface - one is GuidePostsEmptyCache and another is current GuidePostsCache. We create object of GuidePostsEmptyCache when stats are disabled. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services