Class: Mysql::AlterTableQueryHandler
- Inherits:
-
DdlQueryHandler
- Object
- BinlogRecordHandler
- BinlogQueryHandler
- DdlQueryHandler
- Mysql::AlterTableQueryHandler
- Defined in:
- lib/flydata/fluent-plugins/mysql/alter_table_query_handler.rb
Constant Summary collapse
- PATTERN =
/^ALTER TABLE/i
Constants inherited from DdlQueryHandler
DdlQueryHandler::DDL_TABLE_QUERY
Constants inherited from BinlogRecordHandler
BinlogRecordHandler::RESPECT_ORDER, BinlogRecordHandler::SEQ, BinlogRecordHandler::SRC_POS, BinlogRecordHandler::TABLE_NAME, BinlogRecordHandler::TABLE_REV, BinlogRecordHandler::TYPE
Instance Method Summary collapse
-
#initialize(context) ⇒ AlterTableQueryHandler
constructor
A new instance of AlterTableQueryHandler.
- #pattern ⇒ Object
- #process(record, normalized_query) ⇒ Object
Methods inherited from DdlQueryHandler
Constructor Details
#initialize(context) ⇒ AlterTableQueryHandler
Returns a new instance of AlterTableQueryHandler.
8 9 10 |
# File 'lib/flydata/fluent-plugins/mysql/alter_table_query_handler.rb', line 8 def initialize(context) super end |
Instance Method Details
#pattern ⇒ Object
12 13 14 |
# File 'lib/flydata/fluent-plugins/mysql/alter_table_query_handler.rb', line 12 def pattern PATTERN end |
#process(record, normalized_query) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/flydata/fluent-plugins/mysql/alter_table_query_handler.rb', line 16 def process(record, normalized_query) emit_record(:alter_table, record) do |opt| ret = nil begin result = ParserProvider.parser(:mysql, :mysql_alter_table).new.parse(record['query']) if result.nil? $log.error("Received unsupported alter table query. 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. query:'#{record['query']}' Caused by error '#{e.to_s}' Stacktrace : #{e.backtrace.join("\n")} EOS $log.error(msg) end ret end end |