Skip to content

Commit

Permalink
added operation sql for filtering server instances
Browse files Browse the repository at this point in the history
fix #1970
  • Loading branch information
wanghangyu817 committed Jan 30, 2023
1 parent 4304248 commit 35f05ab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public abstract class SchemaChange {

SQL_BLACKLIST.add(Pattern.compile("\\A\\s*(ALTER|CREATE|DROP)\\s+TEMPORARY\\s+TABLE", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
SQL_BLACKLIST.add(Pattern.compile("\\A\\s*(ALTER|CREATE|DROP)\\s+TABLESPACE", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
SQL_BLACKLIST.add(Pattern.compile("\\A\\s*ALTER\\s+INSTANCE\\s+(ROTATE INNODB MASTER KEY|ROTATE BINLOG MASTER KEY|RELOAD TLS)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
SQL_BLACKLIST.add(Pattern.compile("\\A\\s*(SET|DROP|CREATE)\\s+(DEFAULT\\s+)?ROLE", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
SQL_BLACKLIST.add(Pattern.compile("\\A\\s*TRUNCATE\\s+", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
SQL_BLACKLIST.add(Pattern.compile("\\A\\s*OPTIMIZE\\s+", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
Expand Down
14 changes: 14 additions & 0 deletions src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -620,4 +620,18 @@ public void testPolardbXCreateIndexSQL(){
assertThat(changes,is(nullValue()));

}

@Test
public void testServerInstanceOperations(){

List<SchemaChange> parse = parse("ALTER INSTANCE ROTATE INNODB MASTER KEY");
List<SchemaChange> parse1 = parse("ALTER INSTANCE ROTATE BINLOG MASTER KEY");
List<SchemaChange> parse2 = parse("ALTER INSTANCE RELOAD TLS");
List<SchemaChange> parse3 = parse("ALTER INSTANCE RELOAD TLS NO ROLLBACK ON ERROR");

assertThat(parse,is(nullValue()));
assertThat(parse1,is(nullValue()));
assertThat(parse2,is(nullValue()));
assertThat(parse3,is(nullValue()));
}
}

0 comments on commit 35f05ab

Please sign in to comment.