本文整理匯總了Golang中github.com/youtube/vitess/go/vt/mysqlctl.Mysqld.MasterStatus方法的典型用法代碼示例。如果您正苦於以下問題:Golang Mysqld.MasterStatus方法的具體用法?Golang Mysqld.MasterStatus怎麽用?Golang Mysqld.MasterStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/vt/mysqlctl.Mysqld
的用法示例。
在下文中一共展示了Mysqld.MasterStatus方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Open
// Open runs the invalidation loop.
func (rci *RowcacheInvalidator) Open(dbname string, mysqld *mysqlctl.Mysqld) {
rp, err := mysqld.MasterStatus()
if err != nil {
panic(NewTabletError(FATAL, "Rowcache invalidator aborting: cannot determine replication position: %v", err))
}
if mysqld.Cnf().BinLogPath == "" {
panic(NewTabletError(FATAL, "Rowcache invalidator aborting: binlog path not specified"))
}
ok := rci.svm.Go(func(_ *sync2.ServiceManager) {
rci.mu.Lock()
rci.dbname = dbname
rci.mysqld = mysqld
rci.evs = binlog.NewEventStreamer(dbname, mysqld.Cnf().BinLogPath)
rci.GroupId.Set(rp.MasterLogGroupId)
rci.mu.Unlock()
rci.run()
rci.mu.Lock()
rci.evs = nil
rci.mu.Unlock()
})
if ok {
log.Infof("Rowcache invalidator starting, dbname: %s, path: %s, logfile: %s, position: %d", dbname, mysqld.Cnf().BinLogPath, rp.MasterLogFile, rp.MasterLogPosition)
} else {
log.Infof("Rowcache invalidator already running")
}
}