Class: Mysql::BinlogRecordHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/flydata/fluent-plugins/mysql/binlog_record_handler.rb

Direct Known Subclasses

BinlogQueryHandler, DmlRecordHandler

Constant Summary collapse

TABLE_NAME =

A Flydata JSON tag to specify a table name

:table_name
TYPE =
:type
SEQ =
:seq
RESPECT_ORDER =
:respect_order
SRC_POS =
:src_pos
TABLE_REV =
:table_rev
V =

FlyData record format version

:v

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ BinlogRecordHandler

Returns a new instance of BinlogRecordHandler.


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/flydata/fluent-plugins/mysql/binlog_record_handler.rb', line 16

def initialize(context)
  @context = context
  @first_empty_binlog = true
  @table_meta = @context.table_meta

  # Load per-table binlog position
  @table_binlog_pos = {}
  @context.tables.each do |table_name|
    table_binlog_content = @context.sync_fm.get_table_binlog_pos(table_name)
    if table_binlog_content
      @table_binlog_pos[table_name] = Flydata::Mysql::BinLogPosition.new(table_binlog_content)
    end
  end
end