use of io.airlift.units.Duration in project presto by prestodb.
the class TestInsertIntoCassandraTable method testInsertIntoValuesToCassandraMaterizedView.
@Test(groups = CASSANDRA)
public void testInsertIntoValuesToCassandraMaterizedView() throws Exception {
TableName table = mutableTablesState().get(CASSANDRA_INSERT_TABLE).getTableName();
onCasssandra(format("DROP MATERIALIZED VIEW IF EXISTS %s.%s", KEY_SPACE, CASSANDRA_MATERIALIZED_VIEW));
onCasssandra(format("CREATE MATERIALIZED VIEW %s.%s AS " + "SELECT * FROM %s " + "WHERE b IS NOT NULL " + "PRIMARY KEY (a, b) " + "WITH CLUSTERING ORDER BY (integer DESC)", KEY_SPACE, CASSANDRA_MATERIALIZED_VIEW, table.getNameInDatabase()));
assertContainsEventually(() -> query(format("SHOW TABLES FROM %s.%s", CONNECTOR_NAME, KEY_SPACE)), query(format("SELECT lower('%s')", CASSANDRA_MATERIALIZED_VIEW)), new Duration(1, MINUTES));
assertThat(() -> query(format("INSERT INTO %s.%s.%s (a) VALUES (null) ", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_MATERIALIZED_VIEW))).failsWithMessage("Inserting into materialized views not yet supported");
assertThat(() -> query(format("DROP TABLE %s.%s.%s", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_MATERIALIZED_VIEW))).failsWithMessage("Dropping materialized views not yet supported");
onCasssandra(format("DROP MATERIALIZED VIEW IF EXISTS %s.%s", KEY_SPACE, CASSANDRA_MATERIALIZED_VIEW));
}
use of io.airlift.units.Duration in project presto by prestodb.
the class TestFileBasedAccessControlConfig method testExplicitPropertyMappings.
@Test
public void testExplicitPropertyMappings() {
Map<String, String> properties = new ImmutableMap.Builder<String, String>().put(SECURITY_CONFIG_FILE, "/test.json").put(SECURITY_REFRESH_PERIOD, "1s").build();
FileBasedAccessControlConfig expected = new FileBasedAccessControlConfig().setConfigFile("/test.json").setRefreshPeriod(new Duration(1, TimeUnit.SECONDS));
assertFullMapping(properties, expected);
}
use of io.airlift.units.Duration in project presto by prestodb.
the class TestMetadataConfig method testExplicitPropertyMappings.
@Test
public void testExplicitPropertyMappings() {
Map<String, String> properties = new ImmutableMap.Builder<String, String>().put("raptor.startup-grace-period", "42m").put("raptor.reassignment-delay", "6m").put("raptor.reassignment-interval", "7m").put("raptor.minimum-node-count", "39").build();
MetadataConfig expected = new MetadataConfig().setStartupGracePeriod(new Duration(42, MINUTES)).setReassignmentDelay(new Duration(6, MINUTES)).setReassignmentInterval(new Duration(7, MINUTES)).setMinimumNodeCount(39);
assertFullMapping(properties, expected);
}
use of io.airlift.units.Duration in project presto by prestodb.
the class TestRaptorSplitManager method setup.
@BeforeMethod
public void setup() throws Exception {
FunctionAndTypeManager functionAndTypeManager = createTestFunctionAndTypeManager();
DBI dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime() + "_" + ThreadLocalRandom.current().nextInt());
dbi.registerMapper(new TableColumn.Mapper(functionAndTypeManager));
dummyHandle = dbi.open();
createTablesWithRetry(dbi);
temporary = createTempDir();
AssignmentLimiter assignmentLimiter = new AssignmentLimiter(ImmutableSet::of, systemTicker(), new MetadataConfig());
shardManager = new DatabaseShardManager(dbi, new DaoSupplier<>(dbi, ShardDao.class), ImmutableSet::of, assignmentLimiter, systemTicker(), new Duration(0, MINUTES));
TestingNodeManager nodeManager = new TestingNodeManager();
NodeSupplier nodeSupplier = nodeManager::getWorkerNodes;
String nodeName = UUID.randomUUID().toString();
nodeManager.addNode(new InternalNode(nodeName, new URI("http://127.0.0.1/"), NodeVersion.UNKNOWN, false));
RaptorConnectorId connectorId = new RaptorConnectorId("raptor");
metadata = new RaptorMetadata(connectorId.toString(), dbi, shardManager, createTestFunctionAndTypeManager());
metadata.createTable(SESSION, TEST_TABLE, false);
tableHandle = metadata.getTableHandle(SESSION, TEST_TABLE.getTable());
List<ShardInfo> shards = ImmutableList.<ShardInfo>builder().add(shardInfo(UUID.randomUUID(), nodeName)).add(shardInfo(UUID.randomUUID(), nodeName)).add(shardInfo(UUID.randomUUID(), nodeName)).add(shardInfo(UUID.randomUUID(), nodeName)).build();
tableId = ((RaptorTableHandle) tableHandle).getTableId();
List<ColumnInfo> columns = metadata.getColumnHandles(SESSION, tableHandle).values().stream().map(RaptorColumnHandle.class::cast).map(ColumnInfo::fromHandle).collect(toList());
long transactionId = shardManager.beginTransaction();
shardManager.commitShards(transactionId, tableId, columns, shards, Optional.empty(), 0);
raptorSplitManager = new RaptorSplitManager(connectorId, nodeSupplier, shardManager, false);
}
use of io.airlift.units.Duration in project presto by prestodb.
the class TestShardCleanerConfig method testExplicitPropertyMappings.
@Test
public void testExplicitPropertyMappings() {
Map<String, String> properties = new ImmutableMap.Builder<String, String>().put("raptor.max-transaction-age", "42m").put("raptor.transaction-cleaner-interval", "43m").put("raptor.local-cleaner-interval", "31m").put("raptor.local-clean-time", "32m").put("raptor.backup-cleaner-interval", "34m").put("raptor.backup-clean-time", "35m").put("raptor.backup-deletion-threads", "37").put("raptor.max-completed-transaction-age", "39m").build();
ShardCleanerConfig expected = new ShardCleanerConfig().setMaxTransactionAge(new Duration(42, MINUTES)).setTransactionCleanerInterval(new Duration(43, MINUTES)).setLocalCleanerInterval(new Duration(31, MINUTES)).setLocalCleanTime(new Duration(32, MINUTES)).setBackupCleanerInterval(new Duration(34, MINUTES)).setBackupCleanTime(new Duration(35, MINUTES)).setBackupDeletionThreads(37).setMaxCompletedTransactionAge(new Duration(39, MINUTES));
assertFullMapping(properties, expected);
}
Aggregations