本文整理汇总了Golang中github.com/youtube/vitess/go/vt/mysqlctl.MysqlDaemon.MasterPosition方法的典型用法代码示例。如果您正苦于以下问题:Golang MysqlDaemon.MasterPosition方法的具体用法?Golang MysqlDaemon.MasterPosition怎么用?Golang MysqlDaemon.MasterPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/youtube/vitess/go/vt/mysqlctl.MysqlDaemon
的用法示例。
在下文中一共展示了MysqlDaemon.MasterPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Open
// Open runs the invalidation loop.
func (rci *RowcacheInvalidator) Open(dbname string, mysqld mysqlctl.MysqlDaemon) {
// Perform an early check to see if we're already running.
if rci.svm.State() == sync2.SERVICE_RUNNING {
return
}
rp, err := mysqld.MasterPosition()
if err != nil {
panic(NewTabletError(ErrFatal, vtrpc.ErrorCode_INTERNAL_ERROR, "Rowcache invalidator aborting: cannot determine replication position: %v", err))
}
if mysqld.Cnf().BinLogPath == "" {
panic(NewTabletError(ErrFatal, vtrpc.ErrorCode_INTERNAL_ERROR, "Rowcache invalidator aborting: binlog path not specified"))
}
err = rci.qe.ClearRowcache(context.Background())
if err != nil {
panic(NewTabletError(ErrFatal, vtrpc.ErrorCode_INTERNAL_ERROR, "Rowcahe is not reachable"))
}
rci.dbname = dbname
rci.mysqld = mysqld
rci.SetPosition(rp)
ok := rci.svm.Go(rci.run)
if ok {
log.Infof("Rowcache invalidator starting, dbname: %s, path: %s, position: %v", dbname, mysqld.Cnf().BinLogPath, rp)
} else {
log.Infof("Rowcache invalidator already running")
}
}
示例2: Open
// Open runs the invalidation loop.
func (rci *RowcacheInvalidator) Open(dbname string, mysqld mysqlctl.MysqlDaemon) {
rp, err := mysqld.MasterPosition()
if err != nil {
panic(NewTabletError(ErrFatal, "Rowcache invalidator aborting: cannot determine replication position: %v", err))
}
if mysqld.Cnf().BinLogPath == "" {
panic(NewTabletError(ErrFatal, "Rowcache invalidator aborting: binlog path not specified"))
}
rci.dbname = dbname
rci.mysqld = mysqld
rci.SetPosition(rp)
ok := rci.svm.Go(rci.run)
if ok {
log.Infof("Rowcache invalidator starting, dbname: %s, path: %s, position: %v", dbname, mysqld.Cnf().BinLogPath, rp)
} else {
log.Infof("Rowcache invalidator already running")
}
}