Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: read error message until EOF (#4638)
h3n4l1d2d9a111b42
diff --git a/backend/plugin/db/pg/dump.go b/backend/plugin/db/pg/dump.goindex 507f77e23d..fb6c23ba9e 100644--- a/backend/plugin/db/pg/dump.go+++ b/backend/plugin/db/pg/dump.go@@ -146,17 +146,28 @@ func (driver *Driver) dumpOneDatabaseWithPgDump(ctx context.Context, database st}}- errorMsg := make([]byte, 1024)- readSize, readErr := errReader.Read(errorMsg)- if readErr != nil && readErr != io.EOF {- return err- }- if readSize > 0 {- log.Warn(string(errorMsg))+ allMsg := make([]byte, 1024)+ for {+ errorMsg := make([]byte, 1024)+ readSize, readErr := errReader.Read(errorMsg)+ if readSize > 0 {+ log.Warn(string(errorMsg))+ allMsg = append(allMsg, errorMsg...)+ }+ if readErr != nil {+ if readErr == io.EOF {+ break+ }+ return err+ }+ // We may store the error message in meta store, due to the performance concern, we only store the first 1024 bytes.+ if len(allMsg) >= 1024 {+ break+ }}err = cmd.Wait()if err != nil {- return errors.Wrapf(err, "error message: %s", errorMsg)+ return errors.Wrapf(err, "error message: %s", allMsg)}return nil}