Search in sources :

Example 46 with ReadOnlyProps

use of org.apache.phoenix.util.ReadOnlyProps in project phoenix by apache.

the class ParallelStatsEnabledIT method doSetup.

@BeforeClass
public static 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.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(true));
    setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) BeforeClass(org.junit.BeforeClass)

Example 47 with ReadOnlyProps

use of org.apache.phoenix.util.ReadOnlyProps in project phoenix by apache.

the class ConnectionQueryServicesImpl method ensureLocalIndexTableDropped.

private boolean ensureLocalIndexTableDropped(byte[] physicalTableName, long timestamp) throws SQLException {
    HTableDescriptor desc = null;
    boolean wasDeleted = false;
    try (HBaseAdmin admin = getAdmin()) {
        try {
            desc = admin.getTableDescriptor(physicalTableName);
            for (byte[] fam : desc.getFamiliesKeys()) {
                this.tableStatsCache.invalidate(new GuidePostsKey(physicalTableName, fam));
            }
            final ReadOnlyProps props = this.getProps();
            final boolean dropMetadata = props.getBoolean(DROP_METADATA_ATTRIB, DEFAULT_DROP_METADATA);
            if (dropMetadata) {
                List<String> columnFamiles = new ArrayList<String>();
                for (HColumnDescriptor cf : desc.getColumnFamilies()) {
                    if (cf.getNameAsString().startsWith(QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX)) {
                        columnFamiles.add(cf.getNameAsString());
                    }
                }
                for (String cf : columnFamiles) {
                    admin.deleteColumn(physicalTableName, cf);
                }
                clearTableRegionCache(physicalTableName);
                wasDeleted = true;
            }
        } catch (org.apache.hadoop.hbase.TableNotFoundException ignore) {
        // Ignore, as we may never have created a view index table
        }
    } catch (IOException e) {
        throw ServerUtil.parseServerException(e);
    }
    return wasDeleted;
}
Also used : GuidePostsKey(org.apache.phoenix.schema.stats.GuidePostsKey) HColumnDescriptor(org.apache.hadoop.hbase.HColumnDescriptor) ArrayList(java.util.ArrayList) IOException(java.io.IOException) PhoenixIOException(org.apache.phoenix.exception.PhoenixIOException) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) HBaseAdmin(org.apache.hadoop.hbase.client.HBaseAdmin)

Example 48 with ReadOnlyProps

use of org.apache.phoenix.util.ReadOnlyProps in project phoenix by apache.

the class SysTableNamespaceMappedStatsCollectorIT method doSetup.

@BeforeClass
public static void doSetup() throws Exception {
    // enable name space mapping at global level on both client and server side
    Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(7);
    serverProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true");
    serverProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20));
    serverProps.put(QueryServices.IS_SYSTEM_TABLE_MAPPED_TO_NAMESPACE, "true");
    Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(2);
    clientProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true");
    clientProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20));
    clientProps.put(QueryServices.IS_SYSTEM_TABLE_MAPPED_TO_NAMESPACE, "true");
    setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator()));
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) BeforeClass(org.junit.BeforeClass)

Example 49 with ReadOnlyProps

use of org.apache.phoenix.util.ReadOnlyProps in project phoenix by apache.

the class UserDefinedFunctionsIT method doSetup.

@BeforeClass
public static void doSetup() throws Exception {
    Configuration conf = HBaseConfiguration.create();
    setUpConfigForMiniCluster(conf);
    util = new HBaseTestingUtility(conf);
    util.startMiniDFSCluster(1);
    util.startMiniZKCluster(1);
    String string = util.getConfiguration().get("fs.defaultFS");
    conf.set(DYNAMIC_JARS_DIR_KEY, string + "/hbase/tmpjars");
    util.startMiniHBaseCluster(1, 1);
    UDFExpression.setConfig(conf);
    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);
    props.put(QueryServices.ALLOW_USER_DEFINED_FUNCTIONS_ATTRIB, "true");
    props.put(QueryServices.DYNAMIC_JARS_DIR_KEY, string + "/hbase/tmpjars/");
    driver = initAndRegisterTestDriver(url, new ReadOnlyProps(props.entrySet().iterator()));
    compileTestClass(MY_REVERSE_CLASS_NAME, MY_REVERSE_PROGRAM, 1);
    compileTestClass(MY_SUM_CLASS_NAME, MY_SUM_PROGRAM, 2);
    compileTestClass(MY_ARRAY_INDEX_CLASS_NAME, MY_ARRAY_INDEX_PROGRAM, 3);
    compileTestClass(MY_ARRAY_INDEX_CLASS_NAME, MY_ARRAY_INDEX_PROGRAM, 4);
    compileTestClass(GETX_CLASSNAME, GETX_CLASSNAME_PROGRAM, 5);
    compileTestClass(GETY_CLASSNAME, GETY_CLASSNAME_PROGRAM, 6);
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) Configuration(org.apache.hadoop.conf.Configuration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) HBaseTestingUtility(org.apache.hadoop.hbase.HBaseTestingUtility) BeforeClass(org.junit.BeforeClass)

Example 50 with ReadOnlyProps

use of org.apache.phoenix.util.ReadOnlyProps in project phoenix by apache.

the class UpsertSelectIT method doSetup.

@BeforeClass
@Shadower(classBeingShadowed = BaseClientManagedTimeIT.class)
public static void doSetup() throws Exception {
    Map<String, String> props = getDefaultProps();
    props.put(QueryServices.QUEUE_SIZE_ATTRIB, Integer.toString(500));
    props.put(QueryServices.THREAD_POOL_SIZE_ATTRIB, Integer.toString(64));
    // Must update config before starting server
    setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) BeforeClass(org.junit.BeforeClass)

Aggregations

ReadOnlyProps (org.apache.phoenix.util.ReadOnlyProps)56 BeforeClass (org.junit.BeforeClass)32 Test (org.junit.Test)12 IOException (java.io.IOException)6 PhoenixIOException (org.apache.phoenix.exception.PhoenixIOException)6 Properties (java.util.Properties)4 Configuration (org.apache.hadoop.conf.Configuration)4 HBaseAdmin (org.apache.hadoop.hbase.client.HBaseAdmin)4 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)3 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)3 HBaseTestingUtility (org.apache.hadoop.hbase.HBaseTestingUtility)3 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)3 Mutation (org.apache.hadoop.hbase.client.Mutation)3 Batch (org.apache.hadoop.hbase.client.coprocessor.Batch)3 BlockingRpcCallback (org.apache.hadoop.hbase.ipc.BlockingRpcCallback)3 ServerRpcController (org.apache.hadoop.hbase.ipc.ServerRpcController)3 MutationProto (org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto)3 MetaDataMutationResult (org.apache.phoenix.coprocessor.MetaDataProtocol.MetaDataMutationResult)3 MutationCode (org.apache.phoenix.coprocessor.MetaDataProtocol.MutationCode)3 MetaDataResponse (org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse)3