Class: Mysql::DropDatabaseQueryHandler

Inherits:
DatabaseDdlQueryHandler show all
Defined in:
lib/flydata/fluent-plugins/mysql/drop_database_query_handler.rb

Constant Summary collapse

PATTERN =

For MySQL, database and schema are exchangable

/^DROP DATABASE|SCHEMA/i

Constants inherited from DdlQueryHandler

Mysql::DdlQueryHandler::DDL_TABLE_QUERY

Constants inherited from BinlogRecordHandler

BinlogRecordHandler::RESPECT_ORDER, BinlogRecordHandler::SEQ, BinlogRecordHandler::SRC_POS, BinlogRecordHandler::TABLE_NAME, BinlogRecordHandler::TABLE_REV, BinlogRecordHandler::TYPE, BinlogRecordHandler::V

Instance Method Summary collapse

Methods inherited from DatabaseDdlQueryHandler

#emit_record

Methods inherited from DdlQueryHandler

#acceptable_db?, #emit_record, #table_info

Constructor Details

#initialize(context) ⇒ DropDatabaseQueryHandler

Returns a new instance of DropDatabaseQueryHandler.



8
9
10
# File 'lib/flydata/fluent-plugins/mysql/drop_database_query_handler.rb', line 8

def initialize(context)
  super
end

Instance Method Details

#patternObject



12
13
14
# File 'lib/flydata/fluent-plugins/mysql/drop_database_query_handler.rb', line 12

def pattern
  PATTERN
end

#process(record) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/flydata/fluent-plugins/mysql/drop_database_query_handler.rb', line 16

def process(record)
  #Issuing warning message only for the current database.
  if acceptable_db?(record)   #record["db_name"] == @context.database
    $log.warn("DROP DATABASE detected. A full re-sync is required to provide sync consistency. - db_name:'#{record["db_name"]}' query:'#{record["query"]}' normalized query:'#{record['normalized_query']}' binlog_pos:'#{binlog_pos(record)}'")
  end
  #NOTE: No emit_record here because this record should not be sent to data servers for now
end