Sha256: 5d42449961004770201956654d68f7ba2fd194e1d31b2d7d4daaf021ab67522a
Contents?: true
Size: 1.36 KB
Versions: 8
Compression:
Stored size: 1.36 KB
Contents
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 = <<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) # log all alter table events even if the table is not subject to sync. This is for troubleshooting purpose. ret end end end end
Version data entries
8 entries across 8 versions & 1 rubygems