remove relay log

This commit is contained in:
siddontang 2014-06-06 08:30:10 +08:00
parent 8d76a58e5e
commit c05a66a47c
2 changed files with 3 additions and 30 deletions

View File

@ -11,8 +11,7 @@ import (
type Config struct { type Config struct {
DataDB leveldb.Config `json:"data_db"` DataDB leveldb.Config `json:"data_db"`
BinLog replication.BinLogConfig `json:"binlog"` BinLog replication.BinLogConfig `json:"binlog"`
RelayLog replication.RelayLogConfig `json:"relaylog"`
} }
type DB struct { type DB struct {
@ -36,8 +35,7 @@ type Ledis struct {
ldb *leveldb.DB ldb *leveldb.DB
dbs [MaxDBNumber]*DB dbs [MaxDBNumber]*DB
binlog *replication.Log binlog *replication.Log
relaylog *replication.Log
quit chan struct{} quit chan struct{}
} }
@ -73,15 +71,6 @@ func OpenWithConfig(cfg *Config) (*Ledis, error) {
l.binlog = nil l.binlog = nil
} }
if len(cfg.RelayLog.Path) > 0 {
l.relaylog, err = replication.NewRelayLogWithConfig(&cfg.RelayLog)
if err != nil {
return nil, err
}
} else {
l.relaylog = nil
}
for i := uint8(0); i < MaxDBNumber; i++ { for i := uint8(0); i < MaxDBNumber; i++ {
l.dbs[i] = newDB(l, i) l.dbs[i] = newDB(l, i)
} }
@ -117,11 +106,6 @@ func (l *Ledis) Close() {
l.binlog.Close() l.binlog.Close()
l.binlog = nil l.binlog = nil
} }
if l.relaylog != nil {
l.relaylog.Close()
l.relaylog = nil
}
} }
func (l *Ledis) Select(index int) (*DB, error) { func (l *Ledis) Select(index int) (*DB, error) {

View File

@ -11,8 +11,7 @@ import (
) )
var ( var (
errInvalidBinLogEvent = errors.New("invalid binglog event") errInvalidBinLogEvent = errors.New("invalid binglog event")
errRelayLogNotSupported = errors.New("write relay log not supported")
) )
func (l *Ledis) replicateEvent(event []byte) error { func (l *Ledis) replicateEvent(event []byte) error {
@ -131,13 +130,3 @@ func (l *Ledis) RepliateRelayLog(relayLog string, offset int64) (int64, error) {
log.Error("can not go here") log.Error("can not go here")
return offset, nil return offset, nil
} }
func (l *Ledis) WriteRelayLog(data []byte) error {
if l.relaylog == nil {
return errRelayLogNotSupported
}
err := l.relaylog.Log(data)
return err
}