mysql-pure-1.0.1: pure haskell MySQL driver
Copyright(c) Winterland 2016
LicenseBSD
Maintainerdrkoster@qq.com
Stabilityexperimental
PortabilityPORTABLE
Safe HaskellSafe-Inferred
LanguageHaskell2010

Database.MySQL.BinLog

Description

This module provide tools for binlog listening and row based binlog decoding.

Synopsis

binlog utilities

data BinLogTracker Source #

binlog filename and position to start listening.

Constructors

BinLogTracker 

Instances

Instances details
Generic BinLogTracker Source # 
Instance details

Defined in Database.MySQL.BinLog

Associated Types

type Rep BinLogTracker :: Type -> Type #

Show BinLogTracker Source # 
Instance details

Defined in Database.MySQL.BinLog

Eq BinLogTracker Source # 
Instance details

Defined in Database.MySQL.BinLog

type Rep BinLogTracker Source # 
Instance details

Defined in Database.MySQL.BinLog

type Rep BinLogTracker = D1 ('MetaData "BinLogTracker" "Database.MySQL.BinLog" "mysql-pure-1.0.1-C5LW96Ugp5YH6LxucpYsg9" 'False) (C1 ('MetaCons "BinLogTracker" 'PrefixI 'True) (S1 ('MetaSel ('Just "btFileName") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 ByteString) :*: S1 ('MetaSel ('Just "btNextPos") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32)))

registerPesudoSlave :: MySQLConn -> SlaveID -> IO OK Source #

Register a pesudo slave to master, although MySQL document suggests you should call this before calling dumpBinLog, but it seems it's not really necessary.

dumpBinLog Source #

Arguments

:: MySQLConn

connection to be listened

-> SlaveID

a number for our pesudo slave.

-> BinLogTracker

binlog position

-> Bool

if master support semi-ack, do we want to enable it? if master doesn't support, this parameter will be ignored.

-> IO (FormatDescription, IORef ByteString, InputStream BinLogPacket)

FormatDescription, IORef contains current binlog filename, BinLogPacket stream.

Setup binlog listening on given connection, during listening the connection CAN NOT be used to do query, or an UnconsumedResultSet will be thrown.

data RowBinLogEvent Source #

Row based binlog event type.

It's recommended to enable row query event before dumpBinLog, so that you can get RowQueryEvent in row based binlog(it's important for detect a table change for example), more information please refer sysvar_binlog_rows_query_log_events

A BinLogTracker is included so that you can roll up your own HA solutions, for example, writing the tracker to zookeeper when you done with an event.

The first Word32 field is a timestamp present when this event is logged.

Instances

Instances details
Generic RowBinLogEvent Source # 
Instance details

Defined in Database.MySQL.BinLog

Associated Types

type Rep RowBinLogEvent :: Type -> Type #

Show RowBinLogEvent Source # 
Instance details

Defined in Database.MySQL.BinLog

Eq RowBinLogEvent Source # 
Instance details

Defined in Database.MySQL.BinLog

type Rep RowBinLogEvent Source # 
Instance details

Defined in Database.MySQL.BinLog

type Rep RowBinLogEvent = D1 ('MetaData "RowBinLogEvent" "Database.MySQL.BinLog" "mysql-pure-1.0.1-C5LW96Ugp5YH6LxucpYsg9" 'False) ((C1 ('MetaCons "RowQueryEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 BinLogTracker) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 QueryEvent'))) :+: C1 ('MetaCons "RowDeleteEvent" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 BinLogTracker)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TableMapEvent) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DeleteRowsEvent)))) :+: (C1 ('MetaCons "RowWriteEvent" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 BinLogTracker)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TableMapEvent) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 WriteRowsEvent))) :+: C1 ('MetaCons "RowUpdateEvent" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 BinLogTracker)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TableMapEvent) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UpdateRowsEvent)))))

helpers

getLastBinLogTracker :: MySQLConn -> IO (Maybe BinLogTracker) Source #

Get latest master's binlog filename and position.

isCheckSumEnabled :: MySQLConn -> IO Bool Source #

Return True if binlog_checksum = CRC32. Only for MySQL > 5.6

isSemiSyncEnabled :: MySQLConn -> IO Bool Source #

Return True if rpl_semi_sync_master_enabled = ON. Only for MySQL > 5.5

re-export