Compare commits

...

1 Commits

Author SHA1 Message Date
Shlomi Noach
912b002311 in preparation for socket file length limitation 2019-01-28 08:14:24 +02:00
2 changed files with 16 additions and 2 deletions

View File

@ -48,8 +48,9 @@ const (
)
const (
HTTPStatusOK = 200
MaxEventsBatchSize = 1000
HTTPStatusOK = 200
MaxEventsBatchSize = 1000
MaxSocketFileNameLength = 104
)
var (
@ -242,6 +243,10 @@ func NewMigrationContext() *MigrationContext {
}
}
func (this *MigrationContext) GetServeSocketFile() string {
return this.ServeSocketFile
}
func getSafeTableName(baseName string, suffix string) string {
name := fmt.Sprintf("_%s_%s", baseName, suffix)
if len(name) <= mysql.MaxTableNameLength {

View File

@ -56,3 +56,12 @@ func TestGetTableNames(t *testing.T) {
test.S(t).ExpectEquals(context.GetChangelogTableName(), "_tmp_ghc")
}
}
func TestGetServeSocketFile(t *testing.T) {
{
context := NewMigrationContext()
socketFile := "/tmp/gh-ost.sock"
context.ServeSocketFile = socketFile
test.S(t).ExpectEquals(context.GetServeSocketFile(), "/tmp/gh-ost.sock")
}
}