Skip to content

Commit 607c1b1

Browse files
jmartin127Jeff Martin
and
Jeff Martin
authored
Operator logging for database init SQL failures (#3033)
If there is an error in the init SQL that runs as part of reconcileDatabaseInitSQL, then there is no way for the user to know what the error is. Adding this additional log statement will make it easier for users to know when init sql operations have succeeded and/or failed. It also brings this part of the code up to par with other similar operations in the codebase. Issue: #3029 Co-authored-by: Jeff Martin <jeff.martin@previ.com>
1 parent 8261485 commit 607c1b1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/controller/postgrescluster/postgres.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,8 @@ func (r *Reconciler) reconcileDatabaseInitSQL(ctx context.Context,
738738
// A writable pod executor has been found and we have the sql provided by
739739
// the user. Setup a write function to execute the sql using the podExecutor
740740
write := func(ctx context.Context, exec postgres.Executor) error {
741-
_, _, err := exec.Exec(ctx, strings.NewReader(data), map[string]string{})
741+
stdout, stderr, err := exec.Exec(ctx, strings.NewReader(data), map[string]string{})
742+
log.V(1).Info("applied init SQL", "stdout", stdout, "stderr", stderr)
742743
return err
743744
}
744745

0 commit comments

Comments
 (0)