require 'flydata/parser/parser_provider' require 'flydata/fluent-plugins/mysql/ddl_query_handler' module Mysql class AlterTableQueryHandler < TableDdlQueryHandler PATTERN = /^ALTER TABLE/i def initialize(context) super end def pattern PATTERN end def process(record) emit_record(:alter_table, record) do |opt| ret = nil begin result = Flydata::Parser::ParserProvider.parser(:mysql, :mysql_alter_table).new.parse(record["normalized_query"]) if result.nil? $log.error("Received unsupported alter table query. normalized query:'#{record['normalized_query']}', raw query: '#{record['query']}'") else ret = result.tree breaking_query = ret[:actions].any?{|action| !action.has_key?(:support_level) || action[:support_level] != :nonbreaking} opt[:increment_table_rev] = true if breaking_query end rescue => e msg = <