Skip to content

Commit

Permalink
alter/drop add if exist flag
Browse files Browse the repository at this point in the history
  • Loading branch information
junwen12221 committed May 12, 2022
1 parent 17d839f commit 75de667
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ protected Future<Void> onExecute(SQLRequest<SQLCreateIndexStatement> request, My
return lockService.lock(DDL_LOCK, () -> {
try {
SQLCreateIndexStatement sqlCreateIndexStatement = request.getAst();
sqlCreateIndexStatement.setIfNotExists(true);
SQLExprTableSource table = (SQLExprTableSource) sqlCreateIndexStatement.getTable();
resolveSQLExprTableSource(table, dataContext);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,12 @@ public Future<Void> get() {
TableHandler tableHandler = metadataManager.getTable(schema, tableName);
if (tableHandler != null) {
Set<Partition> dataNodes = new HashSet<>(getDataNodes(tableHandler));

try (MycatRouterConfigOps ops = ConfigUpdater.getOps()) {
ops.removeTable(schema, tableName);
ops.commit();
JdbcConnectionManager jdbcConnectionManager = MetaClusterCurrent.wrapper(JdbcConnectionManager.class);
executeOnDataNodes(ast, jdbcConnectionManager, dataNodes, tableSource);
}
JdbcConnectionManager jdbcConnectionManager = MetaClusterCurrent.wrapper(JdbcConnectionManager.class);
executeOnDataNodes(ast, jdbcConnectionManager, dataNodes, tableSource);
}
return response.sendOk();
} catch (Throwable throwable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class TruncateSQLHandler extends AbstractSQLHandler<SQLTruncateStatement>
@Override
protected Future<Void> onExecute(SQLRequest<SQLTruncateStatement> request, MycatDataContext dataContext, Response response) {
SQLTruncateStatement truncateStatement = request.getAst();

truncateStatement.setIfExists(true);
MetadataManager metadataManager = MetaClusterCurrent.wrapper(MetadataManager.class);
JdbcConnectionManager jdbcConnectionManager = MetaClusterCurrent.wrapper(JdbcConnectionManager.class);

Expand Down

0 comments on commit 75de667

Please sign in to comment.