Merge branch 'master' into replication

This commit is contained in:
Alain Jobart 2014-05-19 10:54:21 -07:00
Родитель bcc1d0b6d8 755e8c856a
Коммит e2c18e7d2e
4 изменённых файлов: 87 добавлений и 25 удалений

Просмотреть файл

@ -4,11 +4,15 @@
MAKEFLAGS = -s
all: build unit_test queryservice_test integration_test
.PHONY: all build test clean unit_test unit_test_cover unit_test_race queryservice_test integration_test bson
all: build test
build:
go install ./go/...
test: unit_test queryservice_test integration_test
clean:
go clean -i ./go/...

Просмотреть файл

@ -24,24 +24,72 @@ import (
// populated from an existing my.cnf, or by command line parameters.
// command line parameters.
type Mycnf struct {
ServerId uint32
MysqlPort int
DataDir string
InnodbDataHomeDir string
// ServerId is the unique id for this server.
// Used to create a bunch of named directories.
ServerId uint32
// MysqlPort is the port for the MySQL server running on this machine.
// It is mainly used to communicate with topology server.
MysqlPort int
// DataDir is where the table files are
// (used by vt software for Clone)
DataDir string
// InnodbDataHomeDir is the data directory for innodb.
// (used by vt software for Clone)
InnodbDataHomeDir string
// InnodbLogGroupHomeDir is the logs directory for innodb.
// (used by vt software for Clone)
InnodbLogGroupHomeDir string
SocketFile string
ErrorLogPath string
SlowLogPath string
RelayLogPath string
RelayLogIndexPath string
RelayLogInfoPath string
BinLogPath string
MasterInfoFile string
PidFile string
TmpDir string
SlaveLoadTmpDir string
mycnfMap map[string]string
path string // the actual path that represents this mycnf
// SocketFile is the path to the local mysql.sock file.
// (used by vt software to check server is running)
SocketFile string
// ErrorLogPath is the path to store error logs at.
// (unused by vt software for now)
ErrorLogPath string
// SlowLogPath is the slow query log path
// (unused by vt software for now)
SlowLogPath string
// RelayLogPath is the path of the relay logs
// (unused by vt software for now)
RelayLogPath string
// RelayLogIndexPath is the file name for the relay log index
// (unused by vt software for now)
RelayLogIndexPath string
// RelayLogInfoPath is the file name for the relay log info file
// (unused by vt software for now)
RelayLogInfoPath string
// BinLogPath is the base path for binlogs
// (used by vt software for binlog streaming and rowcache invalidation)
BinLogPath string
// MasterInfoFile is the master.info file location.
// (unused by vt software for now)
MasterInfoFile string
// PidFile is the mysql.pid file location
// (used by vt software to check server is running)
PidFile string
// TmpDir is where to create temporary tables
// (unused by vt software for now)
TmpDir string
// SlaveLoadTmpDir is where to create tmp files for replication
// (unused by vt software for now)
SlaveLoadTmpDir string
mycnfMap map[string]string
path string // the actual path that represents this mycnf
}
func (cnf *Mycnf) lookupAndCheck(key string) string {

Просмотреть файл

@ -383,11 +383,6 @@ func deleteTopDir(dir string) (removalErr error) {
return
}
// Port returns the configured mysql port
func (mysqld *Mysqld) Port() int {
return mysqld.config.MysqlPort
}
// Addr returns the fully qualified host name + port for this instance.
func (mysqld *Mysqld) Addr() string {
hostname := netutil.FullyQualifiedHostnameOrPanic()

Просмотреть файл

@ -141,7 +141,18 @@ func NewActionAgent(
agent.BinlogPlayerMap = NewBinlogPlayerMap(topoServer, &dbcfgs.App.ConnectionParams, mysqld)
RegisterBinlogPlayerMap(agent.BinlogPlayerMap)
if err := agent.Start(mysqld.Port(), port, securePort); err != nil {
// try to figure out the mysql port
mysqlPort := mycnf.MysqlPort
if mysqlPort == 0 {
// we don't know the port, try to get it from mysqld
var err error
mysqlPort, err = mysqld.GetMysqlPort()
if err != nil {
log.Warningf("Cannot get current mysql port, will use 0 for now: %v", err)
}
}
if err := agent.Start(mysqlPort, port, securePort); err != nil {
return nil, err
}
@ -376,7 +387,11 @@ func (agent *ActionAgent) Start(mysqlPort, vtPort, vtsPort int) error {
if tablet.Portmap == nil {
tablet.Portmap = make(map[string]int)
}
tablet.Portmap["mysql"] = mysqlPort
if mysqlPort != 0 {
// only overwrite mysql port if we know it, otherwise
// leave it as is.
tablet.Portmap["mysql"] = mysqlPort
}
tablet.Portmap["vt"] = vtPort
if vtsPort != 0 {
tablet.Portmap["vts"] = vtsPort