Sha256: 92d4607ed570c4eb15ea741cd08750a2dd72a49c5f8dadbfbc75a3c7585a0fc9
Contents?: true
Size: 1.45 KB
Versions: 29
Compression:
Stored size: 1.45 KB
Contents
require 'flydata/parser/parser_provider' require 'flydata/source_mysql/plugin_support/ddl_query_handler' module Flydata module SourceMysql module PluginSupport 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 = <<EOS Received unsupported alter table query. normalized query:'#{record['normalized_query']}', raw query: '#{record['query']}' Caused by error '#{e.to_s}' Stacktrace : #{e.backtrace.join("\n")} EOS $log.error(msg) end $log.info(ret.to_s + " at \"#{binlog_pos(record)}\"") # log all alter table events even if the table is not subject to sync. This is for troubleshooting purpose. ret end end end end end end
Version data entries
29 entries across 29 versions & 1 rubygems