@@ -39,16 +39,16 @@ const PostgresqlPidFile = "postmaster.pid" //wokeignore:rule=master
39
39
// directory and check the existence of the relative process. If the
40
40
// process exists, then that process entry is returned.
41
41
// If it doesn't exist then the PID file is stale and is removed.
42
- func (instance * Instance ) CheckForExistingPostmaster (postgresExecutable string ) (* os.Process , error ) {
42
+ func (instance * Instance ) CheckForExistingPostmaster () (* os.Process , error ) {
43
43
pidFile := path .Join (instance .PgData , PostgresqlPidFile )
44
44
contextLog := log .WithValues ("file" , pidFile )
45
45
pidFileContents , pid , err := instance .GetPostmasterPidFromFile (pidFile )
46
46
if err != nil {
47
47
// The content of the PID file is wrong.
48
48
// In this case we just remove the PID file, which is assumed
49
49
// to be stale, and continue our work
50
- contextLog .Info ("The PID file content is wrong, deleting it and assuming it's stale" )
51
- contextLog . Debug ( "PID file " , "contents " , pidFileContents )
50
+ contextLog .Info ("The PID file content is wrong, deleting it and assuming it's stale" ,
51
+ "err " , err , "pidFileContents " , pidFileContents )
52
52
return nil , instance .CleanUpStalePid ()
53
53
}
54
54
@@ -60,15 +60,14 @@ func (instance *Instance) CheckForExistingPostmaster(postgresExecutable string)
60
60
}
61
61
if process == nil {
62
62
// The process doesn't exist and this PID file is stale
63
- contextLog .Info ("The PID file is stale, deleting it" )
64
- contextLog .Debug ("PID file" , "contents" , pidFileContents )
63
+ contextLog .Info ("The PID file is stale, deleting it" , "pidFileContents" , pidFileContents )
65
64
return nil , instance .CleanUpStalePid ()
66
65
}
67
66
68
- if process .Executable () != postgresExecutable {
67
+ if process .Executable () != postgresName {
69
68
// The process is not running PostgreSQL and this PID file is stale
70
- contextLog .Info ("The PID file is stale (executable mismatch), deleting it" )
71
- contextLog . Debug ( "PID file " , "contents " , pidFileContents )
69
+ contextLog .Info ("The PID file is stale (executable mismatch), deleting it" ,
70
+ "pidFileContents " , pidFileContents , "postgresExecutable " , process . Executable () )
72
71
return nil , instance .CleanUpStalePid ()
73
72
}
74
73
0 commit comments