use of io.airlift.units.Duration in project airlift by airlift.
the class AbstractHttpClientTest method testBadPort.
@Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = ".*port out of range.*")
public void testBadPort() throws Exception {
HttpClientConfig config = createClientConfig();
config.setConnectTimeout(new Duration(5, MILLISECONDS));
Request request = prepareGet().setUri(new URI(scheme, null, host, 70_000, "/", null, null)).build();
executeExceptionRequest(config, request);
}
use of io.airlift.units.Duration in project presto by prestodb.
the class TestStorageManagerConfig method testExplicitPropertyMappings.
@Test
public void testExplicitPropertyMappings() throws Exception {
Map<String, String> properties = new ImmutableMap.Builder<String, String>().put("storage.data-directory", "file:///data").put("storage.file-system", "hdfs").put("storage.min-available-space", "123GB").put("storage.orc.max-merge-distance", "16kB").put("storage.orc.max-read-size", "16kB").put("storage.orc.stream-buffer-size", "16kB").put("storage.orc.tiny-stripe-threshold", "15kB").put("storage.orc.lazy-read-small-ranges", "false").put("storage.orc.optimized-writer-stage", "ENABLED_AND_VALIDATED").put("storage.orc.compression-kind", "SNAPPY").put("storage.max-deletion-threads", "999").put("storage.shard-recovery-timeout", "1m").put("storage.missing-shard-discovery-interval", "4m").put("storage.compaction-enabled", "false").put("storage.compaction-interval", "4h").put("storage.organization-enabled", "false").put("storage.organization-interval", "4h").put("storage.organization-discovery-interval", "2h").put("storage.ejector-interval", "9h").put("storage.max-recovery-threads", "12").put("storage.max-organization-threads", "12").put("storage.max-shard-rows", "10000").put("storage.max-shard-size", "10MB").put("storage.max-buffer-size", "512MB").put("storage.one-split-per-bucket-threshold", "4").put("storage.shard-day-boundary-time-zone", "PST").put("storage.max-allowed-files-per-writer", "50").put("storage.zstd-jni-decompression-enabled", "true").build();
StorageManagerConfig expected = new StorageManagerConfig().setDataDirectory(new URI("file:///data")).setFileSystemProvider("hdfs").setMinAvailableSpace(new DataSize(123, GIGABYTE)).setOrcMaxMergeDistance(new DataSize(16, KILOBYTE)).setOrcMaxReadSize(new DataSize(16, KILOBYTE)).setOrcStreamBufferSize(new DataSize(16, KILOBYTE)).setOrcTinyStripeThreshold(new DataSize(15, KILOBYTE)).setOrcLazyReadSmallRanges(false).setOrcOptimizedWriterStage(ENABLED_AND_VALIDATED).setOrcCompressionKind(SNAPPY).setDeletionThreads(999).setShardRecoveryTimeout(new Duration(1, MINUTES)).setMissingShardDiscoveryInterval(new Duration(4, MINUTES)).setCompactionEnabled(false).setCompactionInterval(new Duration(4, HOURS)).setOrganizationEnabled(false).setOrganizationInterval(new Duration(4, HOURS)).setOrganizationDiscoveryInterval(new Duration(2, HOURS)).setShardEjectorInterval(new Duration(9, HOURS)).setRecoveryThreads(12).setOrganizationThreads(12).setMaxShardRows(10_000).setMaxShardSize(new DataSize(10, MEGABYTE)).setMaxBufferSize(new DataSize(512, MEGABYTE)).setOneSplitPerBucketThreshold(4).setShardDayBoundaryTimeZone("PST").setMaxAllowedFilesPerWriter(50).setZstdJniDecompressionEnabled(true);
assertFullMapping(properties, expected);
}
use of io.airlift.units.Duration in project presto by prestodb.
the class TestRaptorHdfsConfig method testExplicitPropertyMappings.
@Test
public void testExplicitPropertyMappings() {
Map<String, String> properties = new ImmutableMap.Builder<String, String>().put("hive.thrift.client.socks-proxy", "localhost:1080").put("hive.dfs.ipc-ping-interval", "34s").put("hive.dfs-timeout", "33s").put("hive.dfs.connect.timeout", "20s").put("hive.dfs.connect.max-retries", "10").put("hive.dfs.domain-socket-path", "/foo").put("hive.text.max-line-length", "13MB").put("hive.fs.cache.max-size", "1010").put("hive.hdfs.wire-encryption.enabled", "true").put("hive.config.resources", "a,b,c").build();
RaptorHdfsConfig expected = new RaptorHdfsConfig().setSocksProxy(HostAndPort.fromParts("localhost", 1080)).setIpcPingInterval(new Duration(34, TimeUnit.SECONDS)).setDfsTimeout(new Duration(33, TimeUnit.SECONDS)).setDfsConnectTimeout(new Duration(20, TimeUnit.SECONDS)).setDfsConnectMaxRetries(10).setDomainSocketPath("/foo").setTextMaxLineLength(new DataSize(13, Unit.MEGABYTE)).setFileSystemMaxCacheSize(1010).setResourceConfigFiles(ImmutableList.of("a", "b", "c")).setHdfsWireEncryptionEnabled(true);
ConfigAssertions.assertFullMapping(properties, expected);
}
use of io.airlift.units.Duration in project presto by prestodb.
the class TestMemoryWorkerCrash method waitForNodes.
private void waitForNodes(int numberOfNodes) throws InterruptedException {
DistributedQueryRunner queryRunner = (DistributedQueryRunner) getQueryRunner();
long start = System.nanoTime();
while (queryRunner.getCoordinator().refreshNodes().getActiveNodes().size() < numberOfNodes) {
assertLessThan(nanosSince(start), new Duration(10, SECONDS));
MILLISECONDS.sleep(10);
}
}
use of io.airlift.units.Duration in project presto by prestodb.
the class TestPinotConfig method testExplicitPropertyMappings.
@Test
public void testExplicitPropertyMappings() {
Map<String, String> properties = new ImmutableMap.Builder<String, String>().put("pinot.extra-http-headers", "k:v").put("pinot.extra-grpc-metadata", "k1:v1").put("pinot.controller-rest-service", "pinot-controller-service").put("pinot.controller-urls", "host1:1111,host2:1111").put("pinot.idle-timeout", "1h").put("pinot.topn-large", "1000").put("pinot.max-backlog-per-server", "15").put("pinot.max-connections-per-server", "10").put("pinot.min-connections-per-server", "1").put("pinot.thread-pool-size", "100").put("pinot.estimated-size-in-bytes-for-non-numeric-column", "30").put("pinot.connection-timeout", "8m").put("pinot.metadata-expiry", "1m").put("pinot.caller-header-value", "myCaller").put("pinot.caller-header-param", "myParam").put("pinot.service-header-param", "myServiceHeader").put("pinot.allow-multiple-aggregations", "false").put("pinot.infer-date-type-in-schema", "false").put("pinot.infer-timestamp-type-in-schema", "false").put("pinot.forbid-broker-queries", "true").put("pinot.use-pinot-sql-for-broker-queries", "false").put("pinot.rest-proxy-url", "localhost:1111").put("pinot.rest-proxy-service-for-query", "pinot-rest-proxy-service").put("pinot.proxy-grpc-host", "localhost").put("pinot.proxy-grpc-port", "8224").put("pinot.use-proxy-for-broker-request", "true").put("pinot.use-proxy-grpc-endpoint", "true").put("pinot.num-segments-per-split", "2").put("pinot.ignore-empty-responses", "true").put("pinot.fetch-retry-count", "3").put("pinot.mark-data-fetch-exceptions-as-retriable", "false").put("pinot.non-aggregate-limit-for-broker-queries", "10").put("pinot.use-date-trunc", "true").put("pinot.limit-large-for-segment", "100").put("pinot.pushdown-topn-broker-queries", "true").put("pinot.forbid-segment-queries", "true").put("pinot.use-streaming-for-segment-queries", "true").put("pinot.streaming-server-grpc-max-inbound-message-bytes", "65536").put("pinot.use-https-for-controller", "true").put("pinot.use-https-for-broker", "true").put("pinot.use-https-for-proxy", "true").put("pinot.override-distinct-count-function", "distinctCountBitmap").build();
PinotConfig expected = new PinotConfig().setExtraHttpHeaders("k:v").setExtraGrpcMetadata("k1:v1").setControllerRestService("pinot-controller-service").setControllerUrls("host1:1111,host2:1111").setRestProxyUrl("localhost:1111").setProxyGrpcHost("localhost").setProxyGrpcPort(8224).setUseProxyForBrokerRequest(true).setUseProxyGrpcEndpoint(true).setIdleTimeout(new Duration(1, TimeUnit.HOURS)).setLimitLargeForSegment(100000).setTopNLarge(1000).setMaxBacklogPerServer(15).setMaxConnectionsPerServer(10).setMinConnectionsPerServer(1).setThreadPoolSize(100).setEstimatedSizeInBytesForNonNumericColumn(30).setConnectionTimeout(new Duration(8, TimeUnit.MINUTES)).setServiceHeaderParam("myServiceHeader").setCallerHeaderValue("myCaller").setCallerHeaderParam("myParam").setOverrideDistinctCountFunction("distinctCountBitmap").setMetadataCacheExpiry(new Duration(1, TimeUnit.MINUTES)).setAllowMultipleAggregations(false).setInferDateTypeInSchema(false).setInferTimestampTypeInSchema(false).setForbidBrokerQueries(true).setUsePinotSqlForBrokerQueries(false).setRestProxyServiceForQuery("pinot-rest-proxy-service").setNumSegmentsPerSplit(2).setIgnoreEmptyResponses(true).setFetchRetryCount(3).setMarkDataFetchExceptionsAsRetriable(false).setNonAggregateLimitForBrokerQueries(10).setLimitLargeForSegment(100).setPushdownTopNBrokerQueries(true).setForbidSegmentQueries(true).setUseStreamingForSegmentQueries(true).setStreamingServerGrpcMaxInboundMessageBytes(65536).setUseDateTrunc(true).setUseHttpsForController(true).setUseHttpsForBroker(true).setUseHttpsForProxy(true);
ConfigAssertions.assertFullMapping(properties, expected);
}
Aggregations