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

ASF GitHub Bot commented on PHOENIX-1457:
-----------------------------------------

Github user twdsilva commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/55#discussion_r27155154
  
    --- Diff: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/PhoenixRpcIT.java ---
    @@ -0,0 +1,264 @@
    +/*
    + * 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.phoenix.end2end.index;
    +
    +import static org.apache.phoenix.util.PhoenixRuntime.JDBC_PROTOCOL;
    +import static 
org.apache.phoenix.util.PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR;
    +import static 
org.apache.phoenix.util.PhoenixRuntime.JDBC_PROTOCOL_TERMINATOR;
    +import static 
org.apache.phoenix.util.PhoenixRuntime.PHOENIX_TEST_DRIVER_URL_PARAM;
    +import static org.apache.phoenix.util.TestUtil.LOCALHOST;
    +import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
    +import static org.junit.Assert.assertEquals;
    +import static org.junit.Assert.assertFalse;
    +import static org.junit.Assert.assertNotEquals;
    +import static org.junit.Assert.assertTrue;
    +
    +import java.sql.Connection;
    +import java.sql.PreparedStatement;
    +import java.sql.ResultSet;
    +import java.util.List;
    +import java.util.Properties;
    +
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.hadoop.hbase.HBaseConfiguration;
    +import org.apache.hadoop.hbase.HBaseTestingUtility;
    +import org.apache.hadoop.hbase.HRegionInfo;
    +import org.apache.hadoop.hbase.MiniHBaseCluster;
    +import org.apache.hadoop.hbase.ServerName;
    +import org.apache.hadoop.hbase.client.HBaseAdmin;
    +import org.apache.hadoop.hbase.ipc.BalancedQueueRpcExecutor;
    +import org.apache.hadoop.hbase.ipc.CallRunner;
    +import org.apache.hadoop.hbase.ipc.PhoenixRpcScheduler;
    +import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
    +import org.apache.hadoop.hbase.ipc.RpcExecutor;
    +import org.apache.hadoop.hbase.ipc.RpcScheduler;
    +import org.apache.hadoop.hbase.master.AssignmentManager;
    +import org.apache.hadoop.hbase.master.HMaster;
    +import org.apache.hadoop.hbase.regionserver.HRegionServer;
    +import org.apache.hadoop.hbase.regionserver.RegionServerServices;
    +import org.apache.hadoop.hbase.util.Bytes;
    +import org.apache.phoenix.end2end.NeedsOwnMiniClusterTest;
    +import org.apache.phoenix.hbase.index.PhoenixRpcControllerFactory;
    +import org.apache.phoenix.hbase.index.ipc.PhoenixRpcSchedulerFactory;
    +import org.apache.phoenix.jdbc.PhoenixTestDriver;
    +import org.apache.phoenix.query.BaseTest;
    +import org.apache.phoenix.query.QueryServices;
    +import org.apache.phoenix.util.PropertiesUtil;
    +import org.apache.phoenix.util.QueryUtil;
    +import org.apache.phoenix.util.ReadOnlyProps;
    +import org.apache.phoenix.util.SchemaUtil;
    +import org.junit.After;
    +import org.junit.Before;
    +import org.junit.Test;
    +import org.junit.experimental.categories.Category;
    +import org.mockito.Mockito;
    +
    +
    +@Category(NeedsOwnMiniClusterTest.class)
    +public class PhoenixRpcIT extends BaseTest {
    +
    +    private static final String SCHEMA_NAME = "S";
    +    private static final String INDEX_TABLE_NAME = "I";
    +    private static final String DATA_TABLE_FULL_NAME = 
SchemaUtil.getTableName(SCHEMA_NAME, "T");
    +    private static final String INDEX_TABLE_FULL_NAME = 
SchemaUtil.getTableName(SCHEMA_NAME, "I");
    +    private static final int NUM_SLAVES = 2;
    +
    +    private static String url;
    +    private static PhoenixTestDriver driver;
    +    private HBaseTestingUtility util;
    +    private HBaseAdmin admin;
    +    private Configuration conf;
    +    private static RpcExecutor indexRpcExecutor = Mockito.spy(new 
BalancedQueueRpcExecutor("test-index-queue", 30, 1, 300));
    +    private static RpcExecutor metadataRpcExecutor = Mockito.spy(new 
BalancedQueueRpcExecutor("test-metataqueue", 30, 1, 300));
    +    
    +    /**
    +     * Factory that uses a spyed RpcExecutor
    +     */
    +    public static class TestPhoenixIndexRpcSchedulerFactory extends 
PhoenixRpcSchedulerFactory {
    +        @Override
    +        public RpcScheduler create(Configuration conf, 
RegionServerServices services) {
    +            PhoenixRpcScheduler phoenixIndexRpcScheduler = 
(PhoenixRpcScheduler)super.create(conf, services);
    +            
phoenixIndexRpcScheduler.setIndexExecutorForTesting(indexRpcExecutor);
    +            
phoenixIndexRpcScheduler.setMetadataExecutorForTesting(metadataRpcExecutor);
    +            return phoenixIndexRpcScheduler;
    +        }
    +    }
    +
    +    @Before
    +    public void doSetup() throws Exception {
    +        conf = HBaseConfiguration.create();
    +        setUpConfigForMiniCluster(conf);
    +        conf.set(HRegionServer.REGION_SERVER_RPC_SCHEDULER_FACTORY_CLASS,
    +                TestPhoenixIndexRpcSchedulerFactory.class.getName());
    +        conf.set(RpcControllerFactory.CUSTOM_CONTROLLER_CONF_KEY, 
PhoenixRpcControllerFactory.class.getName());
    +        util = new HBaseTestingUtility(conf);
    +        // start cluster with 2 region servers
    +        util.startMiniCluster(NUM_SLAVES);
    +        admin = util.getHBaseAdmin();
    +        String clientPort = 
util.getConfiguration().get(QueryServices.ZOOKEEPER_PORT_ATTRIB);
    +        url = JDBC_PROTOCOL + JDBC_PROTOCOL_SEPARATOR + LOCALHOST + 
JDBC_PROTOCOL_SEPARATOR + clientPort
    --- End diff --
    
    Yes there is getLocalClusterUrl, I will use that.


> Use high priority queue for metadata endpoint calls
> ---------------------------------------------------
>
>                 Key: PHOENIX-1457
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1457
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: Thomas D'Silva
>              Labels: 4.3.1
>
> If the RS hosting the system table gets swamped, then we'd be bottlenecked 
> waiting for the response back before running a query when we check if the 
> metadata is in sync. We should run endpoint coprocessor calls for 
> MetaDataService at a high priority to avoid that.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to