Skip to content

repmgr node rejoin can fail if command is run for two instances at the same time #920

Description

@mbanck-cd

We have a customer that runs several Postgres instances on the same repmgr-managed host. For security reasons, each service runs under its own username.

This leads to issues during repmgr node rejoin, as this command redirects output into a /tmp/node-rejoin.$TIMESTAMP file (where $TIMESTAMP are the seconds since the Unix epoch), so if two repmgr node rejoin commands are issued in the same second, the later one will fail as it cannot write into the logfile from the other process (umask being 0022, i.e. -rw-r--r--).

I guess there are two things that coiuld be done here: either add milliseconds (or microseconds?) to the timestamp to close down the race window considerably (making the logfile name longer) or maybe check whether repmgr can write to the file from node_rejoin_log and if not, re-try after a short timeout, before running the command itself.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions