Skip to content
This repository was archived by the owner on Oct 2, 2025. It is now read-only.

Use separate error buffers for different processes in gprestore helper#87

Merged
Stolb27 merged 2 commits intomasterfrom
ADBDEV-5538
Jun 3, 2024
Merged

Use separate error buffers for different processes in gprestore helper#87
Stolb27 merged 2 commits intomasterfrom
ADBDEV-5538

Conversation

@whitehawk
Copy link

@whitehawk whitehawk commented May 27, 2024

Use separate error buffers for different processes in gprestore helper

Problem description:
gprestore helper reused one error buffer for stderr of multiple processes when
it worked with a plugin. It resulted in the following problem: if the plugin was
launched several times, the error could be detected only on the 2nd run, while
the error happens (i.e. plugin outputs something to the stderr) on each plugin
run.

Fix:
Add a separate error buffer for each RestoreReader.

As now there is no need for global 'errBuf' variable, it was moved to
'doBackupAgent' as a local variable (keeping it global without obvious need is a
bad practice). For the backup helper case, it is ok to have only one buffer as
only one backup plugin instance is started for each backup helper.

Tests are not added because the problem has no stable reproduction scenario - it
depends on the timing of writing to the stderr.

Problem description:
gprestore helper reused one error buffer for multiple processes when it worked
with a plugin. It resulted in the following problem: if the plugin was launched
several times, the error was detected only on the 2nd run, while the error
happens on each plugin run.

Fix:
Add a separate error buffer for each RestoreReader.

For the backup helper case, keep one error buffer as only one backup plugin
instance is started for each backup helper (but now the buffer is made local in
doBackupAgent).
@whitehawk whitehawk marked this pull request as ready for review May 28, 2024 13:11
@Stolb27 Stolb27 merged commit ab19bff into master Jun 3, 2024
@Stolb27 Stolb27 deleted the ADBDEV-5538 branch June 3, 2024 15:22
RekGRpth added a commit that referenced this pull request Aug 1, 2024
RekGRpth pushed a commit that referenced this pull request Aug 1, 2024
#87)

Problem description:
gprestore helper reused one error buffer for stderr of multiple processes when
it worked with a plugin. It resulted in the following problem: if the plugin was
launched several times, the error could be detected only on the 2nd run, while
the error happens (i.e. plugin outputs something to the stderr) on each plugin
run.

Fix:
Add a separate error buffer for each RestoreReader.

As now there is no need for global 'errBuf' variable, it was moved to
'doBackupAgent' as a local variable (keeping it global without obvious need is a
bad practice). For the backup helper case, it is ok to have only one buffer as
only one backup plugin instance is started for each backup helper.

Tests are not added because the problem has no stable reproduction scenario - it
depends on the timing of writing to the stderr.

(cherry picked from commit ab19bff)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants