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 F3B30200C85 for ; Tue, 30 May 2017 21:01:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id F262C160BC9; Tue, 30 May 2017 19:01:59 +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 5553B160BB1 for ; Tue, 30 May 2017 21:01:59 +0200 (CEST) Received: (qmail 89563 invoked by uid 500); 30 May 2017 19:01:58 -0000 Mailing-List: contact dev-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list dev@accumulo.apache.org Received: (qmail 89552 invoked by uid 99); 30 May 2017 19:01:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 May 2017 19:01:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C9F6CE0016; Tue, 30 May 2017 19:01:57 +0000 (UTC) From: ivakegg To: dev@accumulo.apache.org Reply-To: dev@accumulo.apache.org References: In-Reply-To: Subject: [GitHub] accumulo pull request #253: ACCUMULO-4086 Improve volume chooser fallback Content-Type: text/plain Message-Id: <20170530190157.C9F6CE0016@git1-us-west.apache.org> Date: Tue, 30 May 2017 19:01:57 +0000 (UTC) archived-at: Tue, 30 May 2017 19:02:00 -0000 Github user ivakegg commented on a diff in the pull request: https://github.com/apache/accumulo/pull/253#discussion_r119186512 --- Diff: server/base/src/main/java/org/apache/accumulo/server/fs/PerTableVolumeChooser.java --- @@ -67,86 +69,67 @@ public String choose(VolumeChooserEnvironment env, String[] options) throws Accu return chooser.choose(env, options); } - private VolumeChooser getVolumeChooserForTable(VolumeChooserEnvironment env, ServerConfigurationFactory localConf) { + private VolumeChooser getVolumeChooserForTable(VolumeChooserEnvironment env, ServerConfigurationFactory localConf) throws AccumuloException { VolumeChooser chooser; if (log.isTraceEnabled()) { log.trace("Table id: " + env.getTableId()); } final TableConfiguration tableConf = localConf.getTableConfiguration(env.getTableId()); String clazz = tableConf.get(Property.TABLE_VOLUME_CHOOSER); - if (null == clazz || clazz.isEmpty()) { - chooser = fallbackVolumeChooser; - } else { - chooser = tableSpecificChooser.get(env.getTableId()); - if (chooser == null) { - VolumeChooser temp = Property.createTableInstanceFromPropertyName(tableConf, Property.TABLE_VOLUME_CHOOSER, VolumeChooser.class, fallbackVolumeChooser); - chooser = tableSpecificChooser.putIfAbsent(env.getTableId(), temp); - if (chooser == null) { - chooser = temp; - // Otherwise, someone else beat us to initializing; use theirs. - } - } else if (!(chooser.getClass().getName().equals(clazz))) { - if (log.isTraceEnabled()) { - log.trace("change detected for table id: " + env.getTableId()); - } - // the configuration for this table's chooser has been updated. In the case of failure to instantiate we'll repeat here next call. - // TODO stricter definition of when the updated property is used, ref ACCUMULO-3412 - VolumeChooser temp = Property.createTableInstanceFromPropertyName(tableConf, Property.TABLE_VOLUME_CHOOSER, VolumeChooser.class, fallbackVolumeChooser); - VolumeChooser last = tableSpecificChooser.replace(env.getTableId(), temp); - if (chooser.equals(last)) { - chooser = temp; - } else { - // Someone else beat us to updating; use theirs. - chooser = last; - } - } - } - return chooser; + + return createVolumeChooser(clazz, Property.TABLE_VOLUME_CHOOSER.getKey(), env.getTableId(), tableSpecificChooser); } - private VolumeChooser getVolumeChooserForNonTable(VolumeChooserEnvironment env, ServerConfigurationFactory localConf) { + private VolumeChooser getVolumeChooserForNonTable(VolumeChooserEnvironment env, ServerConfigurationFactory localConf) throws AccumuloException { VolumeChooser chooser; - final String customProperty = Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey() + env.getScope() + ".volume.chooser"; + String property = VOLUME_CHOOSER_SCOPED_KEY(env.getScope()); if (log.isTraceEnabled()) { log.trace("Scope: " + env.getScope()); - log.trace("Looking up property: " + customProperty); + log.trace("Looking up property: " + property); } AccumuloConfiguration systemConfiguration = localConf.getConfiguration(); - String clazz = systemConfiguration.get(customProperty); + String clazz = systemConfiguration.get(property); + // only if the custom property is not set to we fallback to the table volumn chooser setting + if (null == clazz) { --- End diff -- @ctubbsii The problem is that in the PerTableVolumeChooser we are looking for general.custom.logger.volume.chooser, and then falling back to the table.volume.chooser if not set (see lines 93-97). This seems a like hokey. So instead we are thinking of changing the property to tserver.nontable.volume.chooser (non-scope specific) and then remove the fallback to the table.volume.chooser. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---