Skip to content
8 changes: 5 additions & 3 deletions gpMgmt/bin/ggrebalance
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def parseargs():
help='Replay lag(in GBs) allowed on mirror when rebalancing the segments.')
parser.add_option('-v', '--verbose', action='store_true', default=False,
help='debug output.')
parser.add_option('--inplace-swap-roles', dest="inplace_swap_roles", action='store_true', default=False,
help='Allows to place primary and mirror at the same host during rebalance.')

# Parse the command line arguments
options, args = parser.parse_args()
Expand Down Expand Up @@ -145,20 +147,20 @@ def validate_options(options, args, parser):

('target_datadirs', ['target_datadirs_file']),

('skip_rebalance', ['mirror_mode']),
('skip_rebalance', ['mirror_mode', 'inplace_swap_roles']),

('clean_required', [
'target_hosts', 'target_hosts_file', 'add_hosts', 'add_hosts_file',
'remove_hosts', 'remove_hosts_file', 'target_datadirs', 'target_datadirs_file',
'target_segment_count', 'mirror_mode', 'skip_rebalance', 'show_plan',
'skip_resource_estimation', 'analyze', 'replay_lag', 'hba_hostnames'
'skip_resource_estimation', 'analyze', 'replay_lag', 'hba_hostnames', 'inplace_swap_roles'
Comment thread
whitehawk marked this conversation as resolved.
]),

('rollback_required', [
'target_hosts', 'target_hosts_file', 'add_hosts', 'add_hosts_file',
'remove_hosts', 'remove_hosts_file', 'target_datadirs', 'target_datadirs_file',
'target_segment_count', 'mirror_mode', 'skip_rebalance', 'show_plan',
'skip_resource_estimation', 'duration', 'end'
'skip_resource_estimation', 'duration', 'end', 'inplace_swap_roles'
]),
]

Expand Down
3 changes: 2 additions & 1 deletion gpMgmt/bin/gprebalance_modules/ggrebalance_sm.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ def create_config_file(self, moves: List[LogicalMove]) -> str:
with open(filename, 'w') as fp:
for move in moves:
segment_current_info = move.seg
if not self.lookup_seg(segment_current_info):
is_swap_phase3 = (move.swap_metadata is not None and move.swap_metadata.get('phase') == 3)
if not is_swap_phase3 and not self.lookup_seg(segment_current_info):
self.logger.info(f'Skip segment for gpmovemirrors: {str(segment_current_info)}')
continue
cfg_line = f'{segment_current_info.getSegmentHostName()}|{segment_current_info.getSegmentPort()}|{segment_current_info.getSegmentDataDirectory()} '
Expand Down
Loading