Skip to content

Commit

Permalink
fix: 修复gh-ost的ghost_initially_drop_socket_file 参数不生效的问题(#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanchuanchuan committed Oct 16, 2021
1 parent 05f8348 commit d896e9b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions session/osc.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,15 @@ func (s *session) mysqlExecuteWithGhost(r *Record) {

// unix socket file max 104 characters (or 107)
socketFile := s.getSocketFile(r)
if _, err := os.Stat(socketFile); err == nil {
s.appendErrorMessage("listen unix socket file already in use, need to clean up manually")
return
} else if err != nil && !strings.Contains(err.Error(), "no such file or directory") {
log.Errorf("con:%d %v", s.sessionVars.ConnectionID, err)
s.appendErrorMessage(err.Error())
return
if !s.ghost.GhostInitiallyDropSocketFile {
if _, err := os.Stat(socketFile); err == nil {
s.appendErrorMessage("listen unix socket file already in use, need to clean up manually")
return
} else if err != nil && !strings.Contains(err.Error(), "no such file or directory") {
log.Errorf("con:%d %v", s.sessionVars.ConnectionID, err)
s.appendErrorMessage(err.Error())
return
}
}

buf.WriteString(fmt.Sprintf(" --serve-socket-file=%s", socketFile))
Expand Down

0 comments on commit d896e9b

Please sign in to comment.