use of io.prestosql.metastore.HetuMetaStoreManager in project hetu-core by openlookeng.
the class TestRollbackTask method testUnknownTransactionRollback.
@Test
public void testUnknownTransactionRollback() {
TransactionManager transactionManager = createTestTransactionManager();
Session session = sessionBuilder().setTransactionId(// Use a random transaction ID that is unknown to the system
TransactionId.create()).build();
QueryStateMachine stateMachine = createQueryStateMachine("ROLLBACK", session, transactionManager);
getFutureValue(new RollbackTask().execute(new Rollback(), transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())));
// Still issue clear signal
assertTrue(stateMachine.getQueryInfo(Optional.empty()).isClearTransactionId());
assertFalse(stateMachine.getQueryInfo(Optional.empty()).getStartedTransactionId().isPresent());
assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
}
use of io.prestosql.metastore.HetuMetaStoreManager in project hetu-core by openlookeng.
the class TestStartTransactionTask method testStartTransactionTooManyIsolationLevels.
@Test
public void testStartTransactionTooManyIsolationLevels() {
Session session = sessionBuilder().setClientTransactionSupport().build();
TransactionManager transactionManager = createTestTransactionManager();
QueryStateMachine stateMachine = createQueryStateMachine("START TRANSACTION", session, transactionManager);
assertFalse(stateMachine.getSession().getTransactionId().isPresent());
assertSemanticExceptionThrownBy(() -> getFutureValue(new StartTransactionTask().execute(new StartTransaction(ImmutableList.of(new Isolation(Isolation.Level.READ_COMMITTED), new Isolation(Isolation.Level.READ_COMMITTED))), transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())))).hasErrorCode(INVALID_TRANSACTION_MODE);
assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
assertFalse(stateMachine.getQueryInfo(Optional.empty()).isClearTransactionId());
assertFalse(stateMachine.getQueryInfo(Optional.empty()).getStartedTransactionId().isPresent());
}
use of io.prestosql.metastore.HetuMetaStoreManager in project hetu-core by openlookeng.
the class TestDeallocateTask method executeDeallocate.
private Set<String> executeDeallocate(String statementName, String sqlString, Session session) {
TransactionManager transactionManager = createTestTransactionManager();
AccessControl accessControl = new AccessControlManager(transactionManager);
QueryStateMachine stateMachine = QueryStateMachine.begin(sqlString, Optional.empty(), session, URI.create("fake://uri"), new ResourceGroupId("test"), new NoOpResourceGroupManager(), false, transactionManager, accessControl, executor, metadata, WarningCollector.NOOP);
Deallocate deallocate = new Deallocate(new Identifier(statementName));
new DeallocateTask().execute(deallocate, transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager()));
return stateMachine.getDeallocatedPreparedStatements();
}
use of io.prestosql.metastore.HetuMetaStoreManager in project hetu-core by openlookeng.
the class TestDropCacheTask method testDropCacheNotExistsTrue.
@Test
public void testDropCacheNotExistsTrue() {
QualifiedName tableName = QualifiedName.of(CATALOG_NAME, schema, table);
DropCache statement = new DropCache(tableName, true);
getFutureValue(new DropCacheTask().execute(statement, createTestTransactionManager(), metadata, new AllowAllAccessControl(), stateMachine, Collections.emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())));
assertFalse(SplitCacheMap.getInstance().cacheExists(tableName));
QualifiedName table2Name = QualifiedName.of(CATALOG_NAME, schema, table2);
DropCache statement2 = new DropCache(table2Name, true);
assertTrue(SplitCacheMap.getInstance().cacheExists(table2Name));
getFutureValue(new DropCacheTask().execute(statement2, createTestTransactionManager(), metadata, new AllowAllAccessControl(), stateMachine, Collections.emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())));
assertFalse(SplitCacheMap.getInstance().cacheExists(table2Name));
}
use of io.prestosql.metastore.HetuMetaStoreManager in project hetu-core by openlookeng.
the class TestDropCacheTask method testDropCacheNotExistsFalse.
@Test
public void testDropCacheNotExistsFalse() {
DropCache statement = new DropCache(QualifiedName.of("test_nonexistent_table"), false);
QueryStateMachine queryStateMachine = createQueryStateMachine("START TRANSACTION", testSession, transactionManager);
try {
getFutureValue(new DropCacheTask().execute(statement, createTestTransactionManager(), metadata, new AllowAllAccessControl(), queryStateMachine, Collections.emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())));
fail("expected exception");
} catch (RuntimeException e) {
// Expected
assertTrue(e instanceof SemanticException);
SemanticException semanticException = (SemanticException) e;
assertEquals(semanticException.getCode(), SemanticErrorCode.MISSING_CACHE);
}
}
Aggregations