Search in sources :

Example 56 with ReadOnlyProps

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

the class PMetaDataImplTest method shouldAlwaysKeepOneEntryIfMaxSizeIsZero.

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

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