Sha256: fea73f177d6ca433575f5208df519829264f3ba0efeb99e0a5019465592bbd5e
Contents?: true
Size: 1.19 KB
Versions: 5
Compression:
Stored size: 1.19 KB
Contents
require 'flydata/parser_provider' require 'flydata/fluent-plugins/mysql/ddl_query_handler' module Mysql class AlterTableQueryHandler < DdlQueryHandler PATTERN = /^ALTER TABLE/i def initialize(context) super end def pattern PATTERN end def process(record, normalized_query) emit_record(:alter_table, record) do |opt| ret = nil begin result = ParserProvider.parser(:mysql, :mysql_alter_table).new.parse(normalized_query) if result.nil? $log.error("Received unsupported alter table query. normalized query:'#{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:'#{normalized_query}', raw query: '#{record['query']}' Caused by error '#{e.to_s}' Stacktrace : #{e.backtrace.join("\n")} EOS $log.error(msg) end ret end end end end
Version data entries
5 entries across 5 versions & 1 rubygems