in preparation for socket file length limitation

This commit is contained in:
Shlomi Noach 2019-01-28 08:14:24 +02:00
parent e48844de0b
commit 912b002311
2 changed files with 16 additions and 2 deletions

View File

@ -50,6 +50,7 @@ const (
const (
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")
}
}