Skip to content

Commit 35f05ab

Browse files
committed
added operation sql for filtering server instances
fix #1970
1 parent 4304248 commit 35f05ab

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/main/java/com/zendesk/maxwell/schema/ddl/SchemaChange.java

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public abstract class SchemaChange {
4242

4343
SQL_BLACKLIST.add(Pattern.compile("\\A\\s*(ALTER|CREATE|DROP)\\s+TEMPORARY\\s+TABLE", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
4444
SQL_BLACKLIST.add(Pattern.compile("\\A\\s*(ALTER|CREATE|DROP)\\s+TABLESPACE", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
45+
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));
4546
SQL_BLACKLIST.add(Pattern.compile("\\A\\s*(SET|DROP|CREATE)\\s+(DEFAULT\\s+)?ROLE", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
4647
SQL_BLACKLIST.add(Pattern.compile("\\A\\s*TRUNCATE\\s+", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));
4748
SQL_BLACKLIST.add(Pattern.compile("\\A\\s*OPTIMIZE\\s+", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE));

src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java

+14
Original file line numberDiff line numberDiff line change
@@ -620,4 +620,18 @@ public void testPolardbXCreateIndexSQL(){
620620
assertThat(changes,is(nullValue()));
621621

622622
}
623+
624+
@Test
625+
public void testServerInstanceOperations(){
626+
627+
List<SchemaChange> parse = parse("ALTER INSTANCE ROTATE INNODB MASTER KEY");
628+
List<SchemaChange> parse1 = parse("ALTER INSTANCE ROTATE BINLOG MASTER KEY");
629+
List<SchemaChange> parse2 = parse("ALTER INSTANCE RELOAD TLS");
630+
List<SchemaChange> parse3 = parse("ALTER INSTANCE RELOAD TLS NO ROLLBACK ON ERROR");
631+
632+
assertThat(parse,is(nullValue()));
633+
assertThat(parse1,is(nullValue()));
634+
assertThat(parse2,is(nullValue()));
635+
assertThat(parse3,is(nullValue()));
636+
}
623637
}

0 commit comments

Comments
 (0)