Search in sources :

Example 36 with ReadOnlyProps

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

the class PMetaDataImplTest method testSchema.

@Test
public void testSchema() throws Exception {
    TestTimeKeeper timeKeeper = new TestTimeKeeper();
    PMetaData metaData = new PMetaDataImpl(5, timeKeeper, new ReadOnlyProps(Collections.EMPTY_MAP));
    PSchema schema = new PSchema("testSchema");
    metaData.addSchema(schema);
    assertEquals(schema, metaData.getSchema(schema.getSchemaKey()));
    metaData.removeSchema(schema, schema.getTimeStamp());
    try {
        metaData.getSchema(schema.getSchemaKey());
        fail("the schema should be removed");
    } catch (SchemaNotFoundException e) {
    }
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) PSchema(org.apache.phoenix.parse.PSchema) Test(org.junit.Test)

Example 37 with ReadOnlyProps

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

the class SequenceIT method doSetup.

@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()));
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) BeforeClass(org.junit.BeforeClass)

Example 38 with ReadOnlyProps

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

the class SpillableGroupByIT method doSetup.

@BeforeClass
public static void doSetup() throws Exception {
    Map<String, String> props = Maps.newHashMapWithExpectedSize(11);
    // Set a very small cache size to force plenty of spilling
    props.put(QueryServices.GROUPBY_MAX_CACHE_SIZE_ATTRIB, Integer.toString(1));
    props.put(QueryServices.GROUPBY_SPILLABLE_ATTRIB, String.valueOf(true));
    props.put(QueryServices.GROUPBY_SPILL_FILES_ATTRIB, Integer.toString(1));
    // Large enough to not run out of memory, but small enough to spill
    props.put(QueryServices.MAX_MEMORY_SIZE_ATTRIB, Integer.toString(40000));
    // Set guidepost width, but disable stats
    props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20));
    props.put(QueryServices.STATS_ENABLED_ATTRIB, Boolean.toString(false));
    props.put(QueryServices.EXPLAIN_CHUNK_COUNT_ATTRIB, Boolean.TRUE.toString());
    props.put(QueryServices.EXPLAIN_ROW_COUNT_ATTRIB, Boolean.TRUE.toString());
    // Must update config before starting server
    setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) BeforeClass(org.junit.BeforeClass)

Example 39 with ReadOnlyProps

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

the class BasePigIT method doSetup.

@BeforeClass
@Shadower(classBeingShadowed = BaseHBaseManagedTimeIT.class)
public static void doSetup() throws Exception {
    Map<String, String> props = Maps.newHashMapWithExpectedSize(3);
    props.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
    // Must update config before starting server
    setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}
Also used : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) BeforeClass(org.junit.BeforeClass) Shadower(org.apache.phoenix.end2end.Shadower)

Example 40 with ReadOnlyProps

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

the class ConnectionQueryServicesImpl method ensureViewIndexTableDropped.

private boolean ensureViewIndexTableDropped(byte[] physicalTableName, long timestamp) throws SQLException {
    byte[] physicalIndexName = MetaDataUtil.getViewIndexPhysicalName(physicalTableName);
    boolean wasDeleted = false;
    try (HBaseAdmin admin = getAdmin()) {
        try {
            HTableDescriptor desc = admin.getTableDescriptor(physicalIndexName);
            if (Boolean.TRUE.equals(PBoolean.INSTANCE.toObject(desc.getValue(MetaDataUtil.IS_VIEW_INDEX_TABLE_PROP_BYTES)))) {
                final ReadOnlyProps props = this.getProps();
                final boolean dropMetadata = props.getBoolean(DROP_METADATA_ATTRIB, DEFAULT_DROP_METADATA);
                if (dropMetadata) {
                    admin.disableTable(physicalIndexName);
                    admin.deleteTable(physicalIndexName);
                    clearTableRegionCache(physicalIndexName);
                    wasDeleted = true;
                } else {
                    this.tableStatsCache.invalidateAll(desc);
                }
            }
        } 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 : ReadOnlyProps(org.apache.phoenix.util.ReadOnlyProps) HBaseAdmin(org.apache.hadoop.hbase.client.HBaseAdmin) IOException(java.io.IOException) PhoenixIOException(org.apache.phoenix.exception.PhoenixIOException) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor)

Aggregations

ReadOnlyProps (org.apache.phoenix.util.ReadOnlyProps)72 BeforeClass (org.junit.BeforeClass)43 Test (org.junit.Test)14 IOException (java.io.IOException)6 Properties (java.util.Properties)6 PhoenixIOException (org.apache.phoenix.exception.PhoenixIOException)6 ResultSet (java.sql.ResultSet)5 Configuration (org.apache.hadoop.conf.Configuration)5 HBaseAdmin (org.apache.hadoop.hbase.client.HBaseAdmin)5 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)4 HBaseTestingUtility (org.apache.hadoop.hbase.HBaseTestingUtility)4 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)4 PhoenixConnection (org.apache.phoenix.jdbc.PhoenixConnection)4 Connection (java.sql.Connection)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