use of io.prestosql.metastore.HetuMetaStoreManager in project hetu-core by openlookeng.
the class TestCommitTask method testUnknownTransactionCommit.
@Test
public void testUnknownTransactionCommit() {
TransactionManager transactionManager = createTestTransactionManager();
Session session = sessionBuilder().setTransactionId(// Use a random transaction ID that is unknown to the system
TransactionId.create()).build();
QueryStateMachine stateMachine = createQueryStateMachine("COMMIT", session, transactionManager);
Future<?> future = new CommitTask().execute(new Commit(), transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager()));
assertPrestoExceptionThrownBy(() -> getFutureValue(future)).hasErrorCode(UNKNOWN_TRANSACTION);
// 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 TestDropCacheTask method testDropWithNonQualifiedName.
@Test
public void testDropWithNonQualifiedName() {
QualifiedName tableName = QualifiedName.of(table3);
QualifiedName fullName = QualifiedName.of(CATALOG_NAME, schema, table3);
DropCache statement = new DropCache(tableName, true);
Session session = testSessionBuilder().setTransactionId(transactionManager.beginTransaction(false)).setCatalog(CATALOG_NAME).setSchema(schema).build();
QueryStateMachine queryStateMachine = createQueryStateMachine("START TRANSACTION", session, transactionManager);
getFutureValue(new DropCacheTask().execute(statement, createTestTransactionManager(), metadata, new AllowAllAccessControl(), queryStateMachine, Collections.emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())));
assertFalse(SplitCacheMap.getInstance().cacheExists(fullName));
}
use of io.prestosql.metastore.HetuMetaStoreManager in project hetu-core by openlookeng.
the class TestRollbackTask method testNoTransactionRollback.
@Test
public void testNoTransactionRollback() {
TransactionManager transactionManager = createTestTransactionManager();
Session session = sessionBuilder().build();
QueryStateMachine stateMachine = createQueryStateMachine("ROLLBACK", session, transactionManager);
assertPrestoExceptionThrownBy(() -> getFutureValue((Future<?>) new RollbackTask().execute(new Rollback(), transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())))).hasErrorCode(NOT_IN_TRANSACTION);
assertFalse(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 TestSetRoleTask method assertSetRole.
private void assertSetRole(String statement, Map<String, SelectedRole> expected) {
SetRole setRole = (SetRole) parser.createStatement(statement);
QueryStateMachine stateMachine = QueryStateMachine.begin(statement, Optional.empty(), testSessionBuilder().setCatalog(CATALOG_NAME).build(), URI.create("fake://uri"), new ResourceGroupId("test"), new NoOpResourceGroupManager(), false, transactionManager, accessControl, executor, metadata, WarningCollector.NOOP);
new SetRoleTask().execute(setRole, transactionManager, metadata, accessControl, stateMachine, ImmutableList.of(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager()));
QueryInfo queryInfo = stateMachine.getQueryInfo(Optional.empty());
assertEquals(queryInfo.getSetRoles(), expected);
}
use of io.prestosql.metastore.HetuMetaStoreManager in project hetu-core by openlookeng.
the class TestPrepareTask method executePrepare.
private Map<String, String> executePrepare(String statementName, Statement statement, String sqlString, Session session) {
TransactionManager transactionManager = createTestTransactionManager();
QueryStateMachine stateMachine = QueryStateMachine.begin(sqlString, Optional.empty(), session, URI.create("fake://uri"), new ResourceGroupId("test"), new NoOpResourceGroupManager(), false, transactionManager, new AccessControlManager(transactionManager), executor, metadata, WarningCollector.NOOP);
Prepare prepare = new Prepare(identifier(statementName), statement);
new PrepareTask(new SqlParser()).execute(prepare, transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager()));
return stateMachine.getAddedPreparedStatements();
}
Aggregations