-
由 Ashwin Agrawal 提交于
Currently, gp_dbid and gp_contentid is passed as command line arguments for starting QD and QE. Since, the values are stored in master's catalog table, to get the right values, must start the master first. Hence, hard-coded dbid=1 was used for starting the master in admin mode always. This worked fine till dbid was not used for anything on-disk. But given dbid is used for tablespace path in GPDB 6, startting the instance with wrong dbid, means inviting recovery time failues, data corruption or data loss situations. Dbid=1 will go wrong after failover to standby master as it has dbid != 1. This commit hence eliminate the need of passing the gp_dbid and gp_contentid on command line, instead while creating the instance the values are stored in conf files for the instance. This also helps to avoid passing gp_dbid as argument to pg_rewind, which needs to start target instance in single user mode to complete recovery before performing rewind operation. Plus, this eases during development to just use pg_ctl start and not require to correctly pass these values. - gp_contentid is stored in postgresql.conf file. - gp_dbid is stored in internal.auto.conf. - Introduce internal.auto.conf file created during initdb. internal.auto.conf is included from postgresql.conf file. - Separate file is chosen to write gp_dbid for ease handling during pg_rewind and pg_basebackup, as can exclude copying this file from primary to mirror, instead of trying to edit the contents of the same after copy during these operations. gp_contentid remains same for primary and mirror hence having it in postgresql.conf file makes senes. If gp_contentid is also stored in this new file internal.auto.conf then pg_basebackup needs to be passed contentid as well to write to this file. - pg_basebackup: write the gp_dbid after backup. Since, gp_dbid is unique for primary and mirror, pg_basebackup excludes copying internal.auto.conf file storing the gp_dbid. pg_basebackup explicit (over)writes the file with value passed as --target-gp-dbid. --target-gp-dbid due to this is mandatory argument to pg_basebackup now. - gpexpand: update gp_dbid and gp_contentid post directory copy. - pg_upgrade: retain all configuration files for segment. postgresql.auto.conf and internal.auto.conf are also internal configuration files which should be restored back after directory copy. Similar, change is required in gp_upgrade repo in restoreSegmentFiles() after copyMasterDirOverSegment(). - Update tests to avoid passing gp_dbid and gp_contentid. Co-authored-by: NAlexandra Wang <lewang@pivotal.io>
4eaeb7bc