mysql-haskell-0.8.1.0: pure haskell MySQL driver

Copyright(c) Winterland 2016
LicenseBSD
Maintainerdrkoster@qq.com
Stabilityexperimental
PortabilityPORTABLE
Safe HaskellNone
LanguageHaskell2010

Database.MySQL.BinLog

Contents

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

Eq BinLogTracker Source # 
Show BinLogTracker Source # 
Generic BinLogTracker Source # 

Associated Types

type Rep BinLogTracker :: * -> * #

type Rep BinLogTracker Source # 
type Rep BinLogTracker = D1 (MetaData "BinLogTracker" "Database.MySQL.BinLog" "mysql-haskell-0.8.1.0-48wBUmBj6Sp1pid6hDMK2G" False) (C1 (MetaCons "BinLogTracker" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "btFileName") SourceUnpack SourceStrict DecidedStrict) (Rec0 ByteString)) (S1 (MetaSel (Just Symbol "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

Eq RowBinLogEvent Source # 
Show RowBinLogEvent Source # 
Generic RowBinLogEvent Source # 

Associated Types

type Rep RowBinLogEvent :: * -> * #

type Rep RowBinLogEvent Source # 
type Rep RowBinLogEvent = D1 (MetaData "RowBinLogEvent" "Database.MySQL.BinLog" "mysql-haskell-0.8.1.0-48wBUmBj6Sp1pid6hDMK2G" False) ((:+:) ((:+:) (C1 (MetaCons "RowQueryEvent" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedStrict) (Rec0 Word32)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BinLogTracker)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 QueryEvent'))))) (C1 (MetaCons "RowDeleteEvent" PrefixI False) ((:*:) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedStrict) (Rec0 Word32)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BinLogTracker))) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 TableMapEvent)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 DeleteRowsEvent)))))) ((:+:) (C1 (MetaCons "RowWriteEvent" PrefixI False) ((:*:) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedStrict) (Rec0 Word32)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BinLogTracker))) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 TableMapEvent)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 WriteRowsEvent))))) (C1 (MetaCons "RowUpdateEvent" PrefixI False) ((:*:) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedStrict) (Rec0 Word32)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BinLogTracker))) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 TableMapEvent)) (S1 (MetaSel (Nothing 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