drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-5547) Drill config options and session options do not work as intended
Date Fri, 28 Jul 2017 21:28:01 GMT

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

ASF GitHub Bot commented on DRILL-5547:
---------------------------------------

Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/868#discussion_r130189636
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/test/TestConfigLinkage.java ---
    @@ -0,0 +1,77 @@
    +/*
    + * 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.drill.test;
    +
    +import org.apache.drill.exec.ExecConstants;
    +import org.junit.Test;
    +import org.apache.drill.common.config.DrillConfig;
    +import static org.junit.Assert.assertEquals;
    +/*
    + * Tests to test if the linkage between the two config option systems
    + * i.e., the linkage between boot-config system and system/session options.
    + * Tests to assert if the config options are read in the order of session ,system, boot-config
*/
    +
    +public class TestConfigLinkage {
    +
    +  /* Test if session option takes precendence */
    +  @Test
    +  public void testSessionOption() throws Exception {
    +    FixtureBuilder builder = ClusterFixture.builder().sessionOption(ExecConstants.SLICE_TARGET,
10);
    +    try (ClusterFixture cluster = builder.build();
    +         ClientFixture client = cluster.clientFixture()) {
    +      String slice_target = client.queryBuilder().sql("SELECT val FROM sys.options2 where
name='planner.slice_target'").singletonString();
    +      assertEquals(slice_target,"10");
    +    }
    +  }
    +
    +  /* Test if system option takes precendence */
    +  @Test
    +  public void testSystemOption() throws Exception {
    +    FixtureBuilder builder = ClusterFixture.builder().systemOption(ExecConstants.SLICE_TARGET,
20);
    +    try (ClusterFixture cluster = builder.build();
    +         ClientFixture client = cluster.clientFixture()) {
    +      String slice_target = client.queryBuilder().sql("SELECT val FROM sys.options2 where
name='planner.slice_target'").singletonString();
    +      assertEquals(slice_target,"20");
    +    }
    +  }
    +
    +  /* Test if config option takes precedence if config option is not set */
    +  @Test
    +  public void testConfigOption() throws Exception {
    +    FixtureBuilder builder = ClusterFixture.builder()
    +            .configProperty("drill.exec.options."+ExecConstants.SLICE_TARGET, 30);
    +    try (ClusterFixture cluster = builder.build();
    +         ClientFixture client = cluster.clientFixture()) {
    +      String slice_target = client.queryBuilder().sql("SELECT val FROM sys.options2 where
name='planner.slice_target'").singletonString();
    +      assertEquals(slice_target,"30");
    +    }
    +  }
    +
    +  /* Test if altering system option takes precedence over config option */
    +  @Test
    +  public void testAlterSystem() throws Exception {
    +    try (ClusterFixture cluster = ClusterFixture.standardCluster();
    +         ClientFixture client = cluster.clientFixture()) {
    +      client.queryBuilder().sql("ALTER SYSTEM SET `planner.affinity_factor` = 1.5").run();
    +      String affinity_factor = client.queryBuilder().sql("SELECT val FROM sys.options2
where name='planner.affinity_factor'").singletonString();
    +      assertEquals(affinity_factor,"1.5");
    +    }
    +  }
    --- End diff --
    
    Additional cases:
    
    * both session and system options set: the session option takes precedence
    * Query list of options using the new system table, with options in the four states (see
below). Verify that the returned result is correct.
    * Various cases for the max width per node. (Will be tricky, you'll have to get the CPU
count for use in verifying the values.)
    
    Four states: default, system only, session only, both system and session.
    
    Any other code paths that are not exercised by the above set of tests?


> Drill config options and session options do not work as intended
> ----------------------------------------------------------------
>
>                 Key: DRILL-5547
>                 URL: https://issues.apache.org/jira/browse/DRILL-5547
>             Project: Apache Drill
>          Issue Type: Bug
>          Components:  Server
>    Affects Versions: 1.10.0
>            Reporter: Karthikeyan Manivannan
>            Assignee: Venkata Jyothsna Donapati
>             Fix For: Future
>
>
> In Drill, session options should take precedence over config options. But several of
these session options are assigned hard-coded default values when the option validators are
initialized. Because of this config options will never be read and honored even if the user
did not specify the session option. 
> ClassCompilerSelector.JAVA_COMPILER_VALIDATOR uses CompilerPolicy.DEFAULT as the default
value. This default value gets into the session options map via the initialization of validators
in SystemOptionManager. 
> Now any piece of code that tries to check if a session option is set will never see a
null, so it will always use that value and never try to look into the config options. For
example, in the following piece of code from ClassCompilerSelector (), the policy will never
be read from the config file.
> policy = CompilerPolicy.valueOf((value != null) ? value.string_val.toUpperCase() : config.getString(JAVA_COMPILER_CONFIG).toUpperCase());



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

Mime
View raw message