Skip to content

fix(engine): ignore stderr buffer of the process while reading command response, consider exit code only

Artyom Kartasov requested to merge stderr-process-response into master

Description

Ignore stderr buffer of the process while reading command response

  • believe that the presence of data in the stderr buffer is not an error
  • log stderr buffer data in the container logs
  • the command execution error is determined explicitly only by the exit code.

Related issue

When DBLab is working in physical mode, if glibc versions on the source and in DBLab container don't match (e.g. different Ubuntu versions; currently, DBLab containers are built with Debian 11, which has glibc 2.31, same as for Ubuntu 20.04), then for Postgres 15 we have:

2023/06/27 11:09:45 main.go:228: [ERROR]  Failed to run the data retrieval service: failed to promote instance: failed to check recovery mode: failed to read response of exec command: WARNING:  database "postgres" has a collation version mismatch
DETAIL:  The database was created using collation version 2.36, but the operating system provides version 2.31.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.

– and before this fix, snapshot creation failed. While it is not fully correct to continue working when glibc versions mismatch (e.g., some indexes might be corrupted), we do not want snapshot creation to fail.

Examples

After changing

2023/06/27 11:39:09 physical.go:824: [INFO]   Mark data state at:  20230627110755
2023/06/27 11:39:09 tools.go:285: [INFO]   Run checkpoint command [psql -U postgres -d postgres -XAtc checkpoint]
2023/06/27 11:39:09 tools.go:611: [DEBUG]  WARNING:  database "postgres" has a collation version mismatch
DETAIL:  The database was created using collation version 2.36, but the operating system provides version 2.31.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.

2023/06/27 11:39:09 tools.go:297: [INFO]   Checkpoint result:  CHECKPOINT

Checklist

  • MR description has been reviewed
  • MR changes are functionally tested
  • MR does NOT have API/CLI changes OR there are API/CLI changes and they have been reviewed & DOCS ARE ADJUSTED (reference doc, etc)
  • MR does NOT have UI changes OR there are UI changes and they have been reviewed & UX IS REVIEWED
Edited by Nikolay Samokhvalov

Merge request reports