List of usage examples for org.apache.hadoop.conf Configuration setLong
public void setLong(String name, long value)
name
property to a long
. From source file:org.apache.oozie.service.TestHASLAService.java
License:Apache License
protected void setUp() throws Exception { Configuration conf = new Configuration(false); conf.set(Services.CONF_SERVICE_EXT_CLASSES, "org.apache.oozie.service.EventHandlerService," + "org.apache.oozie.sla.service.SLAService"); conf.setClass(EventHandlerService.CONF_LISTENERS, DummySLAEventListener.class, SLAEventListener.class); conf.setLong(SLAService.CONF_JOB_EVENT_LATENCY, 0); // manually do check in this test conf.setInt(SLAService.CONF_SLA_CHECK_INITIAL_DELAY, 100000); conf.setInt(SLAService.CONF_SLA_CHECK_INTERVAL, 100000); conf.setInt(EventHandlerService.CONF_WORKER_THREADS, 0); super.setUp(conf); Services.get().setService(ZKJobsConcurrencyService.class); }
From source file:org.apache.oozie.sla.TestSLAService.java
License:Apache License
@Override @Before/* w w w . j av a2 s . c o m*/ protected void setUp() throws Exception { super.setUp(); Services services = new Services(); Configuration conf = services.getConf(); conf.set(Services.CONF_SERVICE_EXT_CLASSES, "org.apache.oozie.service.EventHandlerService," + "org.apache.oozie.sla.service.SLAService"); conf.setClass(EventHandlerService.CONF_LISTENERS, DummySLAEventListener.class, SLAEventListener.class); conf.setLong(SLAService.CONF_JOB_EVENT_LATENCY, 0); conf.setInt(EventHandlerService.CONF_WORKER_THREADS, 0); services.init(); output.setLength(0); }
From source file:org.apache.phoenix.end2end.index.DropIndexDuringUpsertIT.java
License:Apache License
@Before public void doSetup() throws Exception { Configuration conf = HBaseConfiguration.create(); setUpConfigForMiniCluster(conf);/*from w w w . j a va2 s.com*/ 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())); }
From source file:org.apache.phoenix.end2end.PartialResultServerConfigurationIT.java
License:Apache License
@BeforeClass public static void setUp() throws Exception { Configuration conf = HBaseConfiguration.create(); hbaseTestUtil = new HBaseTestingUtility(conf); setUpConfigForMiniCluster(conf);/*from www . jav a 2s . c om*/ //Enforce the limit of the result, so scans will stop between cells. conf.setLong(HConstants.HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY, 5); conf.setLong(HConstants.HBASE_SERVER_SCANNER_MAX_RESULT_SIZE_KEY, 5); hbaseTestUtil.startMiniCluster(); zkQuorum = "localhost:" + hbaseTestUtil.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(PhoenixDriver.INSTANCE); }
From source file:org.apache.phoenix.hbase.index.covered.example.FailWithoutRetriesIT.java
License:Apache License
/** * If this test times out, then we didn't fail quickly enough. {@link Indexer} maybe isn't * rethrowing the exception correctly?/*from w ww . ja v a2 s . c om*/ * <p> * We use a custom codec to enforce the thrown exception. * @throws Exception */ @Test(timeout = 300000) public void testQuickFailure() throws Exception { // incorrectly setup indexing for the primary table - target index table doesn't exist, which // should quickly return to the client byte[] family = Bytes.toBytes("family"); ColumnGroup fam1 = new ColumnGroup(getIndexTableName()); // values are [col1] fam1.add(new CoveredColumn(family, CoveredColumn.ALL_QUALIFIERS)); CoveredColumnIndexSpecifierBuilder builder = new CoveredColumnIndexSpecifierBuilder(); // add the index family builder.addIndexGroup(fam1); // usually, we would create the index table here, but we don't for the sake of the test. // setup the primary table String primaryTable = Bytes.toString(table.getTableName()); @SuppressWarnings("deprecation") HTableDescriptor pTable = new HTableDescriptor(primaryTable); pTable.addFamily(new HColumnDescriptor(family)); // override the codec so we can use our test one builder.build(pTable, FailingTestCodec.class); // create the primary table HBaseAdmin admin = UTIL.getHBaseAdmin(); admin.createTable(pTable); Configuration conf = new Configuration(UTIL.getConfiguration()); // up the number of retries/wait time to make it obvious that we are failing with retries here conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 20); conf.setLong(HConstants.HBASE_CLIENT_PAUSE, 1000); HTable primary = new HTable(conf, primaryTable); primary.setAutoFlush(false, true); // do a simple put that should be indexed Put p = new Put(Bytes.toBytes("row")); p.add(family, null, Bytes.toBytes("value")); primary.put(p); try { primary.flushCommits(); fail("Shouldn't have gotten a successful write to the primary table"); } catch (RetriesExhaustedWithDetailsException e) { LOG.info("Correclty got a failure of the put!"); } primary.close(); }
From source file:org.apache.phoenix.hbase.index.covered.example.TestFailWithoutRetries.java
License:Apache License
/** * If this test times out, then we didn't fail quickly enough. {@link Indexer} maybe isn't * rethrowing the exception correctly?/*from w w w . j a v a 2s. c o m*/ * <p> * We use a custom codec to enforce the thrown exception. * @throws Exception */ @Test(timeout = 300000) public void testQuickFailure() throws Exception { // incorrectly setup indexing for the primary table - target index table doesn't exist, which // should quickly return to the client byte[] family = Bytes.toBytes("family"); ColumnGroup fam1 = new ColumnGroup(getIndexTableName()); // values are [col1] fam1.add(new CoveredColumn(family, CoveredColumn.ALL_QUALIFIERS)); CoveredColumnIndexSpecifierBuilder builder = new CoveredColumnIndexSpecifierBuilder(); // add the index family builder.addIndexGroup(fam1); // usually, we would create the index table here, but we don't for the sake of the test. // setup the primary table String primaryTable = Bytes.toString(table.getTableName()); HTableDescriptor pTable = new HTableDescriptor(primaryTable); pTable.addFamily(new HColumnDescriptor(family)); // override the codec so we can use our test one builder.build(pTable, FailingTestCodec.class); // create the primary table HBaseAdmin admin = UTIL.getHBaseAdmin(); admin.createTable(pTable); Configuration conf = new Configuration(UTIL.getConfiguration()); // up the number of retries/wait time to make it obvious that we are failing with retries here conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 20); conf.setLong(HConstants.HBASE_CLIENT_PAUSE, 1000); HTable primary = new HTable(conf, primaryTable); primary.setAutoFlush(false, true); // do a simple put that should be indexed Put p = new Put(Bytes.toBytes("row")); p.add(family, null, Bytes.toBytes("value")); primary.put(p); try { primary.flushCommits(); fail("Shouldn't have gotten a successful write to the primary table"); } catch (RetriesExhaustedWithDetailsException e) { LOG.info("Correclty got a failure of the put!"); } primary.close(); }
From source file:org.apache.phoenix.iterate.ScannerLeaseRenewalIT.java
License:Apache License
@BeforeClass public static void setUp() throws Exception { Configuration conf = HBaseConfiguration.create(); hbaseTestUtil = new HBaseTestingUtility(conf); setUpConfigForMiniCluster(conf);// w ww .jav a 2s.c om conf.setLong(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, LEASE_TIMEOUT_PERIOD_MILLIS); hbaseTestUtil.startMiniCluster(); // establish url and quorum. Need to use PhoenixDriver and not PhoenixTestDriver zkQuorum = "localhost:" + hbaseTestUtil.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; Properties driverProps = PropertiesUtil.deepCopy(TEST_PROPERTIES); driverProps.put(RENEW_LEASE_THREAD_POOL_SIZE, Long.toString(4)); // if this property is false, tests will fail with UnknownScannerException errors. driverProps.put(RENEW_LEASE_ENABLED, Boolean.toString(true)); driverProps.put(RENEW_LEASE_THRESHOLD_MILLISECONDS, Long.toString(LEASE_TIMEOUT_PERIOD_MILLIS / 2)); driverProps.put(RUN_RENEW_LEASE_FREQUENCY_INTERVAL_MILLISECONDS, Long.toString(LEASE_TIMEOUT_PERIOD_MILLIS / 4)); driverProps.put(HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, Long.toString(LEASE_TIMEOUT_PERIOD_MILLIS)); // use round robin iterator driverProps.put(FORCE_ROW_KEY_ORDER_ATTRIB, Boolean.toString(false)); DriverManager.registerDriver(PhoenixDriver.INSTANCE); try (PhoenixConnection phxConn = DriverManager.getConnection(url, driverProps) .unwrap(PhoenixConnection.class)) { // run test methods only if we are at the hbase version that supports lease renewal. Assume.assumeTrue(phxConn.getQueryServices().supportsFeature(Feature.RENEW_LEASE)); } }
From source file:org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil.java
License:Apache License
public static void setBatchSize(final Configuration configuration, final Long batchSize) { Preconditions.checkNotNull(configuration); configuration.setLong(UPSERT_BATCH_SIZE, batchSize); }
From source file:org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil.java
License:Apache License
public static long getBatchSize(final Configuration configuration) throws SQLException { Preconditions.checkNotNull(configuration); long batchSize = configuration.getLong(UPSERT_BATCH_SIZE, DEFAULT_UPSERT_BATCH_SIZE); if (batchSize <= 0) { Connection conn = ConnectionUtil.getOutputConnection(configuration); batchSize = ((PhoenixConnection) conn).getMutateBatchSize(); conn.close();//from ww w . ja va 2 s .c o m } configuration.setLong(UPSERT_BATCH_SIZE, batchSize); return batchSize; }
From source file:org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil.java
License:Apache License
public static void setScrutinyBatchSize(Configuration configuration, long batchSize) { Preconditions.checkNotNull(configuration); configuration.setLong(SCRUTINY_BATCH_SIZE, batchSize); }