Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 459B8200D26 for ; Fri, 20 Oct 2017 21:30:41 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 43DF0160BCB; Fri, 20 Oct 2017 19:30:41 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 890A01609ED for ; Fri, 20 Oct 2017 21:30:40 +0200 (CEST) Received: (qmail 82885 invoked by uid 500); 20 Oct 2017 19:30:39 -0000 Mailing-List: contact commits-help@fluo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@fluo.apache.org Delivered-To: mailing list commits@fluo.apache.org Received: (qmail 82876 invoked by uid 99); 20 Oct 2017 19:30:39 -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; Fri, 20 Oct 2017 19:30:39 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id D092181D83; Fri, 20 Oct 2017 19:30:37 +0000 (UTC) Date: Fri, 20 Oct 2017 19:30:36 +0000 To: "commits@fluo.apache.org" Subject: [fluo] branch master updated: fixes #942 VisibilityCache uses FluoConfigurationImpl constants (#943) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <150852783696.4010.10633116420209242959@gitbox.apache.org> From: kturner@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: fluo X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 5180acb943c55726fd4e223e6fe63026b78221c7 X-Git-Newrev: d9fc391ee1c761c83ba52cfca5358aee0b7329fa X-Git-Rev: d9fc391ee1c761c83ba52cfca5358aee0b7329fa X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated archived-at: Fri, 20 Oct 2017 19:30:41 -0000 This is an automated email from the ASF dual-hosted git repository. kturner pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/fluo.git The following commit(s) were added to refs/heads/master by this push: new d9fc391 fixes #942 VisibilityCache uses FluoConfigurationImpl constants (#943) d9fc391 is described below commit d9fc391ee1c761c83ba52cfca5358aee0b7329fa Author: Kenneth AuthorDate: Thu Oct 19 00:18:55 2017 -0700 fixes #942 VisibilityCache uses FluoConfigurationImpl constants (#943) The constructor for VisibilityCache now uses the values from FluoConfigurationImpl. Also, an instantiation test has been included in the event that properties are invalidated in the future. This increases test coverage, which is a good thing. --- .../org/apache/fluo/core/impl/TransactorCache.java | 5 ++-- .../org/apache/fluo/core/impl/TxInfoCache.java | 2 -- .../org/apache/fluo/core/impl/VisibilityCache.java | 8 ++++-- .../apache/fluo/core/impl/VisibilityCacheTest.java | 32 ++++++++++++++++++++++ 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/modules/core/src/main/java/org/apache/fluo/core/impl/TransactorCache.java b/modules/core/src/main/java/org/apache/fluo/core/impl/TransactorCache.java index c2d0d1a..892ba4a 100644 --- a/modules/core/src/main/java/org/apache/fluo/core/impl/TransactorCache.java +++ b/modules/core/src/main/java/org/apache/fluo/core/impl/TransactorCache.java @@ -49,8 +49,9 @@ public class TransactorCache implements AutoCloseable { public TransactorCache(Environment env) { timeoutCache = CacheBuilder.newBuilder().maximumSize(1 << 15) - .expireAfterAccess(TxInfoCache.CACHE_TIMEOUT_MIN, TimeUnit.MINUTES).concurrencyLevel(10) - .build(); + .expireAfterAccess(FluoConfigurationImpl.TX_INFO_CACHE_TIMEOUT_DEFAULT, + TimeUnit.MILLISECONDS) + .concurrencyLevel(10).build(); this.env = env; cache = new PathChildrenCache(env.getSharedResources().getCurator(), diff --git a/modules/core/src/main/java/org/apache/fluo/core/impl/TxInfoCache.java b/modules/core/src/main/java/org/apache/fluo/core/impl/TxInfoCache.java index ddd4900..6d3a49e 100644 --- a/modules/core/src/main/java/org/apache/fluo/core/impl/TxInfoCache.java +++ b/modules/core/src/main/java/org/apache/fluo/core/impl/TxInfoCache.java @@ -26,8 +26,6 @@ import org.apache.fluo.api.data.Column; public class TxInfoCache { - static final int CACHE_TIMEOUT_MIN = 24 * 60; - private static class TxStatusWeigher implements Weigher { @Override public int weigh(PrimaryRowColumn key, TxInfo value) { diff --git a/modules/core/src/main/java/org/apache/fluo/core/impl/VisibilityCache.java b/modules/core/src/main/java/org/apache/fluo/core/impl/VisibilityCache.java index 06b10c4..06c4342 100644 --- a/modules/core/src/main/java/org/apache/fluo/core/impl/VisibilityCache.java +++ b/modules/core/src/main/java/org/apache/fluo/core/impl/VisibilityCache.java @@ -47,9 +47,11 @@ public class VisibilityCache { private final Cache visCache; VisibilityCache() { - visCache = - CacheBuilder.newBuilder().expireAfterAccess(TxInfoCache.CACHE_TIMEOUT_MIN, TimeUnit.MINUTES) - .maximumWeight(10000000).weigher(new VisWeigher()).concurrencyLevel(10).build(); + visCache = CacheBuilder.newBuilder() + .expireAfterAccess(FluoConfigurationImpl.TX_INFO_CACHE_TIMEOUT_DEFAULT, + TimeUnit.MILLISECONDS) + .maximumWeight(FluoConfigurationImpl.TX_INFO_CACHE_SIZE_DEFAULT).weigher(new VisWeigher()) + .concurrencyLevel(10).build(); } public ColumnVisibility getCV(Column col) { diff --git a/modules/core/src/test/java/org/apache/fluo/core/impl/VisibilityCacheTest.java b/modules/core/src/test/java/org/apache/fluo/core/impl/VisibilityCacheTest.java new file mode 100644 index 0000000..81036bb --- /dev/null +++ b/modules/core/src/test/java/org/apache/fluo/core/impl/VisibilityCacheTest.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.fluo.core.impl; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Basic test to ensure instantiation works + */ +public class VisibilityCacheTest { + + @Test + public void testVisibilityCacheConstructor() { + VisibilityCache cache = new VisibilityCache(); + Assert.assertNotNull("VisibilityCache failed to instantiate.", cache); + cache = null; + } +} -- To stop receiving notification emails like this one, please contact ['"commits@fluo.apache.org" '].