Example #1
0
func (c *txnCommitter) writeFinishBinlog(tp binlog.BinlogType, commitTS int64) {
	if !c.shouldWriteBinlog() {
		return
	}
	bin := c.txn.us.GetOption(kv.BinlogData).(*binlog.Binlog)
	bin.Tp = tp
	bin.CommitTs = commitTS
	go func() {
		err := binloginfo.WriteBinlog(bin)
		if err != nil {
			log.Errorf("failed to write binlog: %v", err)
		}
	}()
}
Example #2
0
func (c *txnCommitter) prewriteBinlog() chan error {
	if !c.shouldWriteBinlog() {
		return nil
	}
	ch := make(chan error, 1)
	go func() {
		bin := c.txn.us.GetOption(kv.BinlogData).(*binlog.Binlog)
		bin.StartTs = int64(c.startTS)
		if bin.Tp == binlog.BinlogType_Prewrite {
			bin.PrewriteKey = c.keys[0]
		}
		err := binloginfo.WriteBinlog(bin)
		ch <- errors.Trace(err)
	}()
	return ch
}