Skip to content

Commit db9e849

Browse files
MutableFireyjhjstz
authored andcommitted
Fix: gpexpand to automatically set data directory permissions to 0750
Injects logic into the `_configure_new_segments` method of `gpexpand` to automatically correct segment data directory permissions during cluster expansion.
1 parent c27ec8f commit db9e849

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

gpMgmt/bin/gpexpand

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,24 @@ class SegmentTemplate:
846846
# and mirror information
847847
update_pg_hba_on_segments(self.gparray, self.isHbaHostnames, self.batch_size, expanded_host_content)
848848

849+
new_segments = self.gparray.getExpansionSegDbList()
850+
chmod_commands_by_host = defaultdict(list)
851+
852+
for seg in new_segments:
853+
if seg.isSegmentMirror():
854+
continue
855+
datadir = seg.getSegmentDataDirectory()
856+
hostname = seg.getSegmentHostName()
857+
chmod_commands_by_host[hostname].append("chmod 0750 '%s'" % datadir)
858+
859+
for host, commands in chmod_commands_by_host.items():
860+
if commands:
861+
self.pool.addCommand(Command(name='gpexpand fix permissions on %s' % host,
862+
cmdStr=" && ".join(commands), ctxt=REMOTE, remoteHost=host))
863+
864+
self.pool.join()
865+
self.pool.check_results()
866+
849867
self._start_new_primary_segments()
850868
self._stop_new_primary_segments()
851869

0 commit comments

Comments
 (0)