Java Code Examples for org.apache.phoenix.util.ReadOnlyProps

The following examples show how to use org.apache.phoenix.util.ReadOnlyProps. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: phoenix   Source File: ParallelStatsEnabledIT.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static final void doSetup() throws Exception {
    Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
    props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20));
    props.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, Long.toString(5));
    props.put(QueryServices.MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB, Long.toString(5));
    props.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(true));
    setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));

    TaskRegionEnvironment =
            getUtility()
                    .getRSForFirstRegionInTable(
                            PhoenixDatabaseMetaData.SYSTEM_TASK_HBASE_TABLE_NAME)
                    .getRegions(PhoenixDatabaseMetaData.SYSTEM_TASK_HBASE_TABLE_NAME)
                    .get(0).getCoprocessorHost()
                    .findCoprocessorEnvironment(TaskRegionObserver.class.getName());
}
 
Example 2
Source Project: phoenix   Source File: ViewIT.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static synchronized void doSetup() throws Exception {
    NUM_SLAVES_BASE = 6;
    Map<String, String> props = Collections.emptyMap();
    boolean splitSystemCatalog = (driver == null);
    Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(1);
    serverProps.put(QueryServices.PHOENIX_ACLS_ENABLED, "true");
    serverProps.put(PhoenixMetaDataCoprocessorHost.PHOENIX_META_DATA_COPROCESSOR_CONF_KEY,
        TestMetaDataRegionObserver.class.getName());
    serverProps.put("hbase.coprocessor.abortonerror", "false");
    setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(props.entrySet().iterator()));
    // Split SYSTEM.CATALOG once after the mini-cluster is started
    if (splitSystemCatalog) {
        splitSystemCatalog();
    }
}
 
Example 3
Source Project: phoenix   Source File: SecureUserConnectionsIT.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testMultipleConnectionsAsSameUser() throws Exception {
    final HashSet<ConnectionInfo> connections = new HashSet<>();
    final String princ1 = getUserPrincipal(1);
    final File keytab1 = getUserKeytabFile(1);
    final String url = joinUserAuthentication(BASE_URL, princ1, keytab1);

    UserGroupInformation.loginUserFromKeytab(princ1, keytab1.getPath());
    // Using the same UGI should result in two equivalent ConnectionInfo objects
    connections.add(ConnectionInfo.create(url).normalize(ReadOnlyProps.EMPTY_PROPS, EMPTY_PROPERTIES));
    assertEquals(1, connections.size());
    // Sanity check
    verifyAllConnectionsAreKerberosBased(connections);

    // Because the UGI instances are unique, so are the connections
    connections.add(ConnectionInfo.create(url).normalize(ReadOnlyProps.EMPTY_PROPS, EMPTY_PROPERTIES));
    assertEquals(1, connections.size());
}
 
Example 4
Source Project: phoenix   Source File: DropIndexDuringUpsertIT.java    License: Apache License 2.0 6 votes vote down vote up
@Before
public void doSetup() throws Exception {
    Configuration conf = HBaseConfiguration.create();
    setUpConfigForMiniCluster(conf);
    conf.setInt("hbase.client.retries.number", 2);
    conf.setInt("hbase.client.pause", 5000);
    conf.setInt("hbase.balancer.period", Integer.MAX_VALUE);
    conf.setLong(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_OVERLAP_TIME_ATTRIB, 0);
    util = new HBaseTestingUtility(conf);
    util.startMiniCluster(NUM_SLAVES);
    String clientPort = util.getConfiguration().get(QueryServices.ZOOKEEPER_PORT_ATTRIB);
    url = JDBC_PROTOCOL + JDBC_PROTOCOL_SEPARATOR + LOCALHOST + JDBC_PROTOCOL_SEPARATOR + clientPort
            + JDBC_PROTOCOL_TERMINATOR + PHOENIX_TEST_DRIVER_URL_PARAM;

    Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
    // Must update config before starting server
    props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.toString(true));
    driver = initAndRegisterTestDriver(url, new ReadOnlyProps(props.entrySet().iterator()));
}
 
Example 5
Source Project: phoenix   Source File: QueryTimeoutIT.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testSetRPCTimeOnConnection() throws Exception {
    Properties overriddenProps = PropertiesUtil.deepCopy(TEST_PROPERTIES);
    overriddenProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
    overriddenProps.setProperty("hbase.rpc.timeout", Long.toString(100));
    String url = QueryUtil.getConnectionUrl(overriddenProps, config, "longRunning");
    Connection conn1 = DriverManager.getConnection(url, overriddenProps);
    ConnectionQueryServices s1 = conn1.unwrap(PhoenixConnection.class).getQueryServices();
    ReadOnlyProps configProps = s1.getProps();
    assertEquals("100", configProps.get("hbase.rpc.timeout"));
    
    Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
    props.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
    Connection conn2 = DriverManager.getConnection(getUrl(), props);
    ConnectionQueryServices s2 = conn2.unwrap(PhoenixConnection.class).getQueryServices();
    assertFalse(s1 == s2);
    Connection conn3 = DriverManager.getConnection(getUrl(), props);
    ConnectionQueryServices s3 = conn3.unwrap(PhoenixConnection.class).getQueryServices();
    assertTrue(s2 == s3);
    
    Connection conn4 = DriverManager.getConnection(url, overriddenProps);
    ConnectionQueryServices s4 = conn4.unwrap(PhoenixConnection.class).getQueryServices();
    assertTrue(s1 == s4);
}
 
Example 6
@BeforeClass
public static synchronized void doSetup() throws Exception {
    Map<String, String> serverProps = getServerProps();
    serverProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, Boolean.TRUE.toString());
    Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(3);
    clientProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, Boolean.TRUE.toString());
    clientProps.put(HConstants.HBASE_CLIENT_RETRIES_NUMBER, "2");
    clientProps.put(QueryServices.INDEX_REGION_OBSERVER_ENABLED_ATTRIB, Boolean.FALSE.toString());
    NUM_SLAVES_BASE = 4;
    setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator()));
    TableName systemTable = SchemaUtil.getPhysicalTableName(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES,
            true);
    indexRebuildTaskRegionEnvironment = getUtility()
            .getRSForFirstRegionInTable(systemTable).getRegions(systemTable).get(0).getCoprocessorHost()
            .findCoprocessorEnvironment(MetaDataRegionObserver.class.getName());
    MetaDataRegionObserver.initRebuildIndexConnectionProps(indexRebuildTaskRegionEnvironment.getConfiguration());
}
 
Example 7
private SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver firstConnectionNSMappingServerDisabledClientEnabled()
throws Exception {
    startMiniClusterWithToggleNamespaceMapping(Boolean.FALSE.toString());
    Properties clientProps = getClientProperties(true, true);
    SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver =
      new SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver(ReadOnlyProps.EMPTY_PROPS);
    try {
        driver.getConnectionQueryServices(getJdbcUrl(), clientProps);
        fail("Client should not be able to connect to cluster with inconsistent client-server namespace mapping properties");
    } catch (SQLException sqlE) {
        assertEquals(SQLExceptionCode.INCONSISTENT_NAMESPACE_MAPPING_PROPERTIES.getErrorCode(), sqlE.getErrorCode());
    }
    hbaseTables = getHBaseTables();
    assertEquals(0, hbaseTables.size());
    assertEquals(0, countUpgradeAttempts);
    assertFalse(isSystemNamespaceCreated());
    return driver;
}
 
Example 8
Source Project: phoenix   Source File: ContextClassloaderIT.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static synchronized void setUpBeforeClass() throws Exception {
    Configuration conf = HBaseConfiguration.create();
    setUpConfigForMiniCluster(conf);
    hbaseTestUtil = new HBaseTestingUtility(conf);
    hbaseTestUtil.startMiniCluster();
    String clientPort = hbaseTestUtil.getConfiguration().get(QueryServices.ZOOKEEPER_PORT_ATTRIB);
    String url = JDBC_PROTOCOL + JDBC_PROTOCOL_SEPARATOR + LOCALHOST + JDBC_PROTOCOL_SEPARATOR + clientPort
            + JDBC_PROTOCOL_TERMINATOR + PHOENIX_TEST_DRIVER_URL_PARAM;
    driver = initAndRegisterTestDriver(url, ReadOnlyProps.EMPTY_PROPS);
    
    Connection conn = DriverManager.getConnection(url);
    Statement stmt = conn.createStatement();
    stmt.execute("CREATE TABLE test (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR)");
    stmt.execute("UPSERT INTO test VALUES (1, 'name1')");
    stmt.execute("UPSERT INTO test VALUES (2, 'name2')");
    stmt.close();
    conn.commit();
    conn.close();
    badContextClassloader = new URLClassLoader(new URL[] {
            File.createTempFile("invalid", ".jar").toURI().toURL() }, null);
}
 
Example 9
Source Project: phoenix   Source File: MutableIndexFailureIT.java    License: Apache License 2.0 6 votes vote down vote up
@Before
public void doSetup() throws Exception {
    Configuration conf = HBaseConfiguration.create();
    setUpConfigForMiniCluster(conf);
    conf.setInt("hbase.client.retries.number", 2);
    conf.setInt("hbase.client.pause", 5000);
    conf.setInt("hbase.balancer.period", Integer.MAX_VALUE);
    conf.setLong(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_OVERLAP_TIME_ATTRIB, 0);
    conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, IndexMasterObserver.class.getName());
    conf.setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS, IndexLoadBalancer.class,
        LoadBalancer.class);
    util = new HBaseTestingUtility(conf);
    util.startMiniCluster(NUM_SLAVES);
    String clientPort = util.getConfiguration().get(QueryServices.ZOOKEEPER_PORT_ATTRIB);
    url = JDBC_PROTOCOL + JDBC_PROTOCOL_SEPARATOR + LOCALHOST + JDBC_PROTOCOL_SEPARATOR + clientPort
            + JDBC_PROTOCOL_TERMINATOR + PHOENIX_TEST_DRIVER_URL_PARAM;
    driver = initAndRegisterDriver(url, ReadOnlyProps.EMPTY_PROPS);
}
 
Example 10
Source Project: phoenix   Source File: IndexToolIT.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static synchronized void setup() throws Exception {
    Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(2);
    serverProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20));
    serverProps.put(QueryServices.MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB, Long.toString(5));
    serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
        QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
    serverProps.put(QueryServices.INDEX_REBUILD_PAGE_SIZE_IN_ROWS, Long.toString(8));
    Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(2);
    clientProps.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(true));
    clientProps.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, Long.toString(5));
    clientProps.put(QueryServices.TRANSACTIONS_ENABLED, Boolean.TRUE.toString());
    clientProps.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, Boolean.TRUE.toString());
    setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
        new ReadOnlyProps(clientProps.entrySet().iterator()));
}
 
Example 11
Source Project: phoenix   Source File: ContextClassloaderIT.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws Exception {
    Configuration conf = HBaseConfiguration.create();
    setUpConfigForMiniCluster(conf);
    hbaseTestUtil = new HBaseTestingUtility(conf);
    hbaseTestUtil.startMiniCluster();
    String clientPort = hbaseTestUtil.getConfiguration().get(QueryServices.ZOOKEEPER_PORT_ATTRIB);
    url = JDBC_PROTOCOL + JDBC_PROTOCOL_SEPARATOR + LOCALHOST + JDBC_PROTOCOL_SEPARATOR + clientPort
            + JDBC_PROTOCOL_TERMINATOR + PHOENIX_TEST_DRIVER_URL_PARAM;
    driver = initAndRegisterDriver(url, ReadOnlyProps.EMPTY_PROPS);
    
    Connection conn = DriverManager.getConnection(url);
    Statement stmt = conn.createStatement();
    stmt.execute("CREATE TABLE test (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR)");
    stmt.execute("UPSERT INTO test VALUES (1, 'name1')");
    stmt.execute("UPSERT INTO test VALUES (2, 'name2')");
    stmt.close();
    conn.commit();
    conn.close();
    badContextClassloader = new URLClassLoader(new URL[] {
            File.createTempFile("invalid", ".jar").toURI().toURL() }, null);
}
 
Example 12
Source Project: phoenix   Source File: IndexVerificationOldDesignIT.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static synchronized void setup() throws Exception {
    Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(2);
    serverProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20));
    serverProps.put(QueryServices.MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB, Long.toString(5));
    serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
            QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
    serverProps.put(QueryServices.INDEX_REBUILD_PAGE_SIZE_IN_ROWS, Long.toString(8));
    Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(2);
    clientProps.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(true));
    clientProps.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, Long.toString(5));
    clientProps.put(QueryServices.TRANSACTIONS_ENABLED, Boolean.TRUE.toString());
    clientProps.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, Boolean.TRUE.toString());
    clientProps.put(QueryServices.INDEX_REGION_OBSERVER_ENABLED_ATTRIB,
            Boolean.toString(false));
    setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
            new ReadOnlyProps(clientProps.entrySet().iterator()));
}
 
Example 13
Source Project: phoenix   Source File: PMetaDataImplTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void shouldAlwaysKeepOneEntryIfMaxSizeIsZero() throws Exception {
    TestTimeKeeper timeKeeper = new TestTimeKeeper();
    Map<String, String> props = Maps.newHashMapWithExpectedSize(2);
    props.put(QueryServices.MAX_CLIENT_METADATA_CACHE_SIZE_ATTRIB, "0");
    props.put(QueryServices.CLIENT_CACHE_ENCODING, "object");
    PMetaData metaData = new PMetaDataImpl(5, timeKeeper,  new ReadOnlyProps(props));
    addToTable(metaData, "a", 1, timeKeeper);
    assertEquals(1, metaData.size());
    addToTable(metaData, "b", 1, timeKeeper);
    assertEquals(1, metaData.size());
    addToTable(metaData, "c", 5, timeKeeper);
    assertEquals(1, metaData.size());
    addToTable(metaData, "d", 20, timeKeeper);
    assertEquals(1, metaData.size());
    assertNames(metaData, "d");
    addToTable(metaData, "e", 1, timeKeeper);
    assertEquals(1, metaData.size());
    addToTable(metaData, "f", 2, timeKeeper);
    assertEquals(1, metaData.size());
    assertNames(metaData, "f");
}
 
Example 14
Source Project: phoenix   Source File: PMetaDataImplTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testAge() throws Exception {
    TestTimeKeeper timeKeeper = new TestTimeKeeper();
    Map<String, String> props = Maps.newHashMapWithExpectedSize(2);
    props.put(QueryServices.MAX_CLIENT_METADATA_CACHE_SIZE_ATTRIB, "10");
    props.put(QueryServices.CLIENT_CACHE_ENCODING, "object");
    PMetaData metaData = new PMetaDataImpl(5, timeKeeper,  new ReadOnlyProps(props));
    String tableName = "a";
    addToTable(metaData, tableName, 1, timeKeeper);
    PTableRef aTableRef = metaData.getTableRef(new PTableKey(null,tableName));
    assertNotNull(aTableRef);
    assertEquals(1, metaData.getAge(aTableRef));
    tableName = "b";
    addToTable(metaData, tableName, 1, timeKeeper);
    PTableRef bTableRef = metaData.getTableRef(new PTableKey(null,tableName));
    assertNotNull(bTableRef);
    assertEquals(1, metaData.getAge(bTableRef));
    assertEquals(2, metaData.getAge(aTableRef));
}
 
Example 15
private SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver firstConnectionNSMappingServerEnabledClientDisabled()
throws Exception {
    startMiniClusterWithToggleNamespaceMapping(Boolean.TRUE.toString());
    Properties clientProps = getClientProperties(false, false);
    SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver =
      new SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver(ReadOnlyProps.EMPTY_PROPS);
    try {
        driver.getConnectionQueryServices(getJdbcUrl(), clientProps);
        fail("Client should not be able to connect to cluster with inconsistent client-server namespace mapping properties");
    } catch (SQLException sqlE) {
        assertEquals(SQLExceptionCode.INCONSISTENT_NAMESPACE_MAPPING_PROPERTIES.getErrorCode(), sqlE.getErrorCode());
    }
    hbaseTables = getHBaseTables();
    assertEquals(0, hbaseTables.size());
    assertEquals(0, countUpgradeAttempts);
    return driver;
}
 
Example 16
Source Project: phoenix   Source File: MetaDataRegionObserver.java    License: Apache License 2.0 6 votes vote down vote up
public BuildIndexScheduleTask(RegionCoprocessorEnvironment env, List<String> onlyTheseTables) {
    this.onlyTheseTables = onlyTheseTables == null ? null : ImmutableList.copyOf(onlyTheseTables);
    this.env = env;
    Configuration configuration = env.getConfiguration();
    this.rebuildIndexBatchSize = configuration.getLong(
            QueryServices.INDEX_FAILURE_HANDLING_REBUILD_PERIOD, HConstants.LATEST_TIMESTAMP);
    this.configuredBatches = configuration.getLong(
            QueryServices.INDEX_FAILURE_HANDLING_REBUILD_NUMBER_OF_BATCHES_PER_TABLE, 10);
    this.indexDisableTimestampThreshold =
            configuration.getLong(QueryServices.INDEX_REBUILD_DISABLE_TIMESTAMP_THRESHOLD,
                QueryServicesOptions.DEFAULT_INDEX_REBUILD_DISABLE_TIMESTAMP_THRESHOLD);
    this.pendingDisableThreshold =
            configuration.getLong(QueryServices.INDEX_PENDING_DISABLE_THRESHOLD,
                QueryServicesOptions.DEFAULT_INDEX_PENDING_DISABLE_THRESHOLD);
    this.props = new ReadOnlyProps(env.getConfiguration().iterator());
}
 
Example 17
private static void startServer(String url) throws Exception {
  assertNull(driver);
  // only load the test driver if we are testing locally - for integration tests, we want to
  // test on a wider scale
  if (PhoenixEmbeddedDriver.isTestUrl(url)) {
    driver = initDriver(ReadOnlyProps.EMPTY_PROPS);
    assertTrue(DriverManager.getDriver(url) == driver);
    driver.connect(url, PropertiesUtil.deepCopy(TEST_PROPERTIES));
  }
}
 
Example 18
Source Project: phoenix   Source File: DropSchemaIT.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass 
public static synchronized void doSetup() throws Exception {
    Map<String,String> props = Maps.newHashMapWithExpectedSize(1);
    // Drop the HBase table metadata for this test
    props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.toString(true));
    // Must update config before starting server
    setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}
 
Example 19
Source Project: phoenix   Source File: StatsEnabledSplitSystemCatalogIT.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static synchronized void doSetup() throws Exception {
    NUM_SLAVES_BASE = 3;
    Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
    props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20));
    props.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, Long.toString(5));
    props.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(true));
    setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}
 
Example 20
private SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver firstConnectionNSMappingServerDisabledClientDisabled()
throws Exception {
    startMiniClusterWithToggleNamespaceMapping(Boolean.FALSE.toString());
    Properties clientProps = getClientProperties(false, false);
    SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver =
      new SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver(ReadOnlyProps.EMPTY_PROPS);
    driver.getConnectionQueryServices(getJdbcUrl(), clientProps);
    hbaseTables = getHBaseTables();
    assertEquals(PHOENIX_SYSTEM_TABLES, hbaseTables);
    assertEquals(0, countUpgradeAttempts);
    assertFalse(isSystemNamespaceCreated());
    return driver;
}
 
Example 21
private static String initEmbeddedMiniCluster(Configuration conf, ReadOnlyProps overrideProps) throws Exception {
  setUpConfigForMiniCluster(conf, overrideProps);
  utility = new StandaloneHBaseTestingUtility(conf);

  try {
    utility.startStandaloneHBaseCluster();
    return getLocalClusterUrl(utility);
  } catch (Throwable var3) {
    throw new RuntimeException(var3);
  }
}
 
Example 22
Source Project: phoenix   Source File: OrderByWithSpillingIT.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static synchronized void doSetup() throws Exception {
    Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
    // do lot's of spooling!
    props.put(QueryServices.SERVER_SPOOL_THRESHOLD_BYTES_ATTRIB, Integer.toString(1));
    props.put(QueryServices.CLIENT_SPOOL_THRESHOLD_BYTES_ATTRIB, Integer.toString(1));
    setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}
 
Example 23
Source Project: phoenix   Source File: UngroupedAggregateRegionObserver.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment e) throws IOException {
    // Can't use ClientKeyValueBuilder on server-side because the memstore expects to
    // be able to get a single backing buffer for a KeyValue.
    this.kvBuilder = GenericKeyValueBuilder.INSTANCE;
    /*
     * We need to create a copy of region's configuration since we don't want any side effect of
     * setting the RpcControllerFactory.
     */
    upsertSelectConfig = PropertiesUtil.cloneConfig(e.getConfiguration());
    /*
     * Till PHOENIX-3995 is fixed, we need to use the
     * InterRegionServerIndexRpcControllerFactory. Although this would cause remote RPCs to use
     * index handlers on the destination region servers, it is better than using the regular
     * priority handlers which could result in a deadlock.
     */
    upsertSelectConfig.setClass(RpcControllerFactory.CUSTOM_CONTROLLER_CONF_KEY,
        InterRegionServerIndexRpcControllerFactory.class, RpcControllerFactory.class);

    compactionConfig = ServerUtil.getCompactionConfig(e.getConfiguration());

    // For retries of index write failures, use the same # of retries as the rebuilder
    indexWriteConfig = PropertiesUtil.cloneConfig(e.getConfiguration());
    indexWriteConfig.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
        e.getConfiguration().getInt(QueryServices.INDEX_REBUILD_RPC_RETRIES_COUNTER,
            QueryServicesOptions.DEFAULT_INDEX_REBUILD_RPC_RETRIES_COUNTER));
    indexWriteProps = new ReadOnlyProps(indexWriteConfig.iterator());
}
 
Example 24
Source Project: phoenix   Source File: BaseLocalIndexIT.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static synchronized void doSetup() throws Exception {
    Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(7);
    serverProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true");
    Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1);
    clientProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true");
    // setting update frequency to a large value to test out that we are
    // generating stats for local indexes
    clientProps.put(QueryServices.MIN_STATS_UPDATE_FREQ_MS_ATTRIB, "120000");
    setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator()));
}
 
Example 25
@BeforeClass
public static synchronized void doSetup() throws Exception {
    Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(10);
    serverProps.put(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_ATTRIB,
        Boolean.TRUE.toString());
    serverProps.put(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_INTERVAL_ATTRIB,
        Long.toString(REBUILD_INTERVAL));
    serverProps.put(QueryServices.INDEX_REBUILD_DISABLE_TIMESTAMP_THRESHOLD, "50000000");
    serverProps.put(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_PERIOD,
        Long.toString(REBUILD_PERIOD)); // batch at 50 seconds
    serverProps.put(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_OVERLAP_FORWARD_TIME_ATTRIB,
        Long.toString(WAIT_AFTER_DISABLED));
    Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1);
    clientProps.put(HConstants.HBASE_CLIENT_RETRIES_NUMBER, "2");
    setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
        new ReadOnlyProps(clientProps.entrySet().iterator()));
    indexRebuildTaskRegionEnvironment =
            (RegionCoprocessorEnvironment) getUtility()
                    .getRSForFirstRegionInTable(
                        PhoenixDatabaseMetaData.SYSTEM_CATALOG_HBASE_TABLE_NAME)
                    .getRegions(PhoenixDatabaseMetaData.SYSTEM_CATALOG_HBASE_TABLE_NAME)
                    .get(0).getCoprocessorHost()
                    .findCoprocessorEnvironment(MetaDataRegionObserver.class.getName());
    MetaDataRegionObserver.initRebuildIndexConnectionProps(
        indexRebuildTaskRegionEnvironment.getConfiguration());
    schemaName = generateUniqueName();
    tableName = generateUniqueName();
    fullTableName = SchemaUtil.getTableName(schemaName, tableName);
    indexName = generateUniqueName();
    fullIndexName = SchemaUtil.getTableName(schemaName, indexName);
    conn = DriverManager.getConnection(getUrl());
    phoenixConn = conn.unwrap(PhoenixConnection.class);
}
 
Example 26
Source Project: phoenix   Source File: RenewLeaseIT.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static synchronized void doSetup() throws Exception {
    Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(1);
    serverProps.put("hbase.coprocessor.region.classes", SleepingRegionObserver.class.getName());
    Map<String,String> clientProps = Maps.newHashMapWithExpectedSize(1);
    // Must update config before starting server
    serverProps.put(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, Long.toString(SCANNER_LEASE_TIMEOUT));
    setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator()));
}
 
Example 27
Source Project: phoenix   Source File: QueryWithLimitIT.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void doSetup() throws Exception {
    Map<String,String> props = Maps.newHashMapWithExpectedSize(3);
    // Must update config before starting server
    props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(50));
    props.put(QueryServices.QUEUE_SIZE_ATTRIB, Integer.toString(1));
    props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.TRUE.toString());
    props.put(QueryServices.SEQUENCE_SALT_BUCKETS_ATTRIB, Integer.toString(0)); // Prevents RejectedExecutionException when deleting sequences
    setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}
 
Example 28
Source Project: phoenix   Source File: SequenceIT.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
@Shadower(classBeingShadowed = BaseClientManagedTimeIT.class)
public static void doSetup() throws Exception {
    Map<String,String> props = getDefaultProps();
    // Must update config before starting server
    props.put(QueryServices.SEQUENCE_CACHE_SIZE_ATTRIB, Long.toString(BATCH_SIZE));
    setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}
 
Example 29
Source Project: phoenix   Source File: ParallelIteratorsIT.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void doSetup() throws Exception {
    Map<String,String> props = Maps.newHashMapWithExpectedSize(3);
    // Must update config before starting server
    props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20));
    props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.toString(true));
    setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}
 
Example 30
Source Project: phoenix   Source File: DisableLocalIndexIT.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
@Shadower(classBeingShadowed = BaseHBaseManagedTimeIT.class)
public static void doSetup() throws Exception {
    Map<String,String> props = Maps.newHashMapWithExpectedSize(1);
    // Must update config before starting server
    props.put(QueryServices.ALLOW_LOCAL_INDEX_ATTRIB, Boolean.FALSE.toString());
    setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}